From a81403fd163c28526cbecbef5c6fa9cfa24a9c1a Mon Sep 17 00:00:00 2001 From: philipel Date: Wed, 27 Sep 2017 18:03:50 +0200 Subject: [PATCH] Calculate VP9 references to wrap at kPicIdLength instead of 16 bits. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:8293 Change-Id: Iedc09a10548c2112e99247a5845a02c1bd3e7b80 Reviewed-on: https://webrtc-review.googlesource.com/4200 Reviewed-by: Erik Språng Commit-Queue: Philip Eliasson Cr-Commit-Position: refs/heads/master@{#20017} --- modules/video_coding/rtp_frame_reference_finder.cc | 2 +- .../video_coding/rtp_frame_reference_finder_unittest.cc | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/video_coding/rtp_frame_reference_finder.cc b/modules/video_coding/rtp_frame_reference_finder.cc index b62d4971ea..23e8c81bd6 100644 --- a/modules/video_coding/rtp_frame_reference_finder.cc +++ b/modules/video_coding/rtp_frame_reference_finder.cc @@ -422,7 +422,7 @@ RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameVp9( frame->num_references = codec_header.num_ref_pics; for (size_t i = 0; i < frame->num_references; ++i) { frame->references[i] = - Subtract<1 << 16>(frame->picture_id, codec_header.pid_diff[i]); + Subtract(frame->picture_id, codec_header.pid_diff[i]); } UnwrapPictureIds(frame); diff --git a/modules/video_coding/rtp_frame_reference_finder_unittest.cc b/modules/video_coding/rtp_frame_reference_finder_unittest.cc index bd21ff1308..5a8198787d 100644 --- a/modules/video_coding/rtp_frame_reference_finder_unittest.cc +++ b/modules/video_coding/rtp_frame_reference_finder_unittest.cc @@ -1313,5 +1313,12 @@ TEST_F(TestRtpFrameReferenceFinder, Vp9FlexibleModeTwoSpatialLayersReordered) { CheckReferencesVp9(8, 1, 7); } +TEST_F(TestRtpFrameReferenceFinder, WrappingFlexReference) { + InsertVp9Flex(0, 0, false, 0, 0, 0, 0, false, {1}); + + ASSERT_EQ(1UL, frames_from_callback_.size()); + CheckReferencesVp9(1, 0, 0); +} + } // namespace video_coding } // namespace webrtc