Drop VP8 frames older than the last sync frame in the RtpFrameReferenceFinder.

BUG=webrtc:5514

Review-Url: https://codereview.webrtc.org/2392313002
Cr-Commit-Position: refs/heads/master@{#14745}
This commit is contained in:
philipel
2016-10-24 07:11:53 -07:00
committed by Commit bot
parent 1655e45d85
commit 86b92e05f9
2 changed files with 22 additions and 0 deletions

View File

@ -298,6 +298,14 @@ void RtpFrameReferenceFinder::ManageFrameVp8(
return; return;
} }
// If the last frame on this layer is ahead of this frame it means that
// a layer sync frame has been received after this frame for the same
// base layer frame, drop this frame.
if (AheadOf<uint16_t, kPicIdLength>(layer_info_it->second[layer],
frame->picture_id)) {
return;
}
// If we have not yet received a frame between this frame and the referenced // If we have not yet received a frame between this frame and the referenced
// frame then we have to wait for that frame to be completed first. // frame then we have to wait for that frame to be completed first.
auto not_received_frame_it = auto not_received_frame_it =
@ -309,6 +317,8 @@ void RtpFrameReferenceFinder::ManageFrameVp8(
return; return;
} }
RTC_DCHECK((AheadOf<uint16_t, kPicIdLength>(frame->picture_id,
layer_info_it->second[layer])));
++frame->num_references; ++frame->num_references;
frame->references[layer] = layer_info_it->second[layer]; frame->references[layer] = layer_info_it->second[layer];
} }

View File

@ -597,6 +597,18 @@ TEST_F(TestRtpFrameReferenceFinder, Vp8LayerSync) {
CheckReferencesVp8(pid + 7, pid + 6, pid + 5); CheckReferencesVp8(pid + 7, pid + 6, pid + 5);
} }
TEST_F(TestRtpFrameReferenceFinder, Vp8Tl1SyncFrameAfterTl1Frame) {
InsertVp8(1000, 1000, true, 1, 0, 247, true);
InsertVp8(1001, 1001, false, 3, 0, 248, false);
InsertVp8(1002, 1002, false, 4, 1, 248, false); // Will be dropped
InsertVp8(1003, 1003, false, 5, 1, 248, true); // due to this frame.
ASSERT_EQ(3UL, frames_from_callback_.size());
CheckReferencesVp8(1);
CheckReferencesVp8(3, 1);
CheckReferencesVp8(5, 3);
}
TEST_F(TestRtpFrameReferenceFinder, Vp9GofInsertOneFrame) { TEST_F(TestRtpFrameReferenceFinder, Vp9GofInsertOneFrame) {
uint16_t pid = Rand(); uint16_t pid = Rand();
uint16_t sn = Rand(); uint16_t sn = Rand();