Clear the FrameBuffer in case of a backward jump in the picture id.

Even though this is against the spec we allow a stream to continue if
a backwards jump in the picture id occurs on a keyframe.

BUG=webrtc:7001, webrtc:5514

Review-Url: https://codereview.webrtc.org/2640793003
Cr-Commit-Position: refs/heads/master@{#16146}
This commit is contained in:
philipel
2017-01-18 05:35:20 -08:00
committed by Commit bot
parent 44303ea0ff
commit fcc600651d
3 changed files with 50 additions and 8 deletions

View File

@ -419,5 +419,22 @@ TEST_F(TestFrameBuffer2, LastContinuousFrameTwoLayers) {
EXPECT_EQ(pid + 3, InsertFrame(pid + 3, 1, ts, true, pid + 2));
}
TEST_F(TestFrameBuffer2, PictureIdJumpBack) {
uint16_t pid = Rand();
uint32_t ts = Rand();
EXPECT_EQ(pid, InsertFrame(pid, 0, ts, false));
EXPECT_EQ(pid + 1, InsertFrame(pid + 1, 0, ts + 1, false, pid));
ExtractFrame();
CheckFrame(0, pid, 0);
// Jump back in pid but increase ts.
EXPECT_EQ(pid - 1, InsertFrame(pid - 1, 0, ts + 2, false));
ExtractFrame();
ExtractFrame();
CheckFrame(1, pid - 1, 0);
CheckNoFrame(2);
}
} // namespace video_coding
} // namespace webrtc