Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: webrtc/modules/video_coding/rtp_frame_reference_finder_unittest.cc

Issue 2760893002: Don't recalculate Tl0PicIdx when the VP9 frame has no Tl0PicIdx. (Closed)
Patch Set: Feedback fix + minor refactoring. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/video_coding/rtp_frame_reference_finder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/rtp_frame_reference_finder_unittest.cc
diff --git a/webrtc/modules/video_coding/rtp_frame_reference_finder_unittest.cc b/webrtc/modules/video_coding/rtp_frame_reference_finder_unittest.cc
index cc361ec25863fdacb8c33c5fccecf8880031f697..6ea8e020e236fd38d60405084c5e95dbbc63b7f8 100644
--- a/webrtc/modules/video_coding/rtp_frame_reference_finder_unittest.cc
+++ b/webrtc/modules/video_coding/rtp_frame_reference_finder_unittest.cc
@@ -1285,6 +1285,42 @@ TEST_F(TestRtpFrameReferenceFinder, Vp9FlexibleModeTwoSpatialLayersReordered) {
// TODO(philipel): Remove when VP9 PID/TL0 does not jump mid-stream (should be
// around M59).
+TEST_F(TestRtpFrameReferenceFinder, Vp9PidFix_PidJumpsForwardNoTl0PicIdx) {
+ GofInfoVP9 ss;
+ ss.SetGofInfoVP9(kTemporalStructureMode1);
+
+ VCMPacket packet;
+ packet.timestamp = 0;
+ packet.codec = kVideoCodecVP9;
+ packet.frameType = kVideoFrameKey;
+ packet.markerBit = true;
+ packet.video_header.codecHeader.VP9.flexible_mode = false;
+ packet.video_header.codecHeader.VP9.picture_id = 0;
+ packet.video_header.codecHeader.VP9.temporal_idx = kNoTemporalIdx;
+ packet.video_header.codecHeader.VP9.spatial_idx = kNoSpatialIdx;
+ packet.video_header.codecHeader.VP9.tl0_pic_idx = kNoTl0PicIdx;
+ packet.video_header.codecHeader.VP9.temporal_up_switch = true;
+ packet.video_header.codecHeader.VP9.ss_data_available = true;
+ packet.video_header.codecHeader.VP9.gof = ss;
+
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
+
+ packet.timestamp = 1;
+ packet.video_header.codecHeader.VP9.picture_id = 5000;
+
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
+
+ ASSERT_EQ(2UL, frames_from_callback_.size());
+ CheckReferencesVp9(0, 0);
+ CheckReferencesVp9(128, 0);
+}
+
+// TODO(philipel): Remove when VP9 PID/TL0 does not jump mid-stream (should be
+// around M59).
TEST_F(TestRtpFrameReferenceFinder, Vp9PidFix_PidJumpsBackwardThenForward) {
GofInfoVP9 ss;
ss.SetGofInfoVP9(kTemporalStructureMode1);
@@ -1303,33 +1339,24 @@ TEST_F(TestRtpFrameReferenceFinder, Vp9PidFix_PidJumpsBackwardThenForward) {
packet.video_header.codecHeader.VP9.ss_data_available = true;
packet.video_header.codecHeader.VP9.gof = ss;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
// Timestamp goes forward but pid goes backwards.
packet.timestamp = 1;
packet.video_header.codecHeader.VP9.picture_id = 0;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
packet.timestamp = 2;
packet.video_header.codecHeader.VP9.picture_id = 5000;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
ASSERT_EQ(3UL, frames_from_callback_.size());
CheckReferencesVp9(1, 0);
@@ -1356,45 +1383,33 @@ TEST_F(TestRtpFrameReferenceFinder, Vp9PidFix_Tl0JumpsBackwardThenForward) {
packet.video_header.codecHeader.VP9.temporal_up_switch = true;
packet.video_header.codecHeader.VP9.ss_data_available = true;
packet.video_header.codecHeader.VP9.gof = ss;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
packet.timestamp = 1;
packet.video_header.codecHeader.VP9.picture_id = 1;
packet.video_header.codecHeader.VP9.tl0_pic_idx = 0;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
packet.timestamp = 2;
packet.frameType = kVideoFrameDelta;
packet.video_header.codecHeader.VP9.picture_id = 2;
packet.video_header.codecHeader.VP9.tl0_pic_idx = 2;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
packet.timestamp = 3;
packet.frameType = kVideoFrameKey;
packet.video_header.codecHeader.VP9.ss_data_available = true;
packet.video_header.codecHeader.VP9.picture_id = 3;
packet.video_header.codecHeader.VP9.tl0_pic_idx = 129;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
ASSERT_EQ(4UL, frames_from_callback_.size());
CheckReferencesVp9(0, 0);
@@ -1422,42 +1437,30 @@ TEST_F(TestRtpFrameReferenceFinder, Vp9PidFix_PidSmallJumpForward) {
packet.video_header.codecHeader.VP9.temporal_up_switch = true;
packet.video_header.codecHeader.VP9.ss_data_available = true;
packet.video_header.codecHeader.VP9.gof = ss;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
packet.timestamp = 1;
packet.video_header.codecHeader.VP9.picture_id = 2;
packet.video_header.codecHeader.VP9.tl0_pic_idx = 2;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
packet.timestamp = 2;
packet.video_header.codecHeader.VP9.picture_id = 3;
packet.video_header.codecHeader.VP9.tl0_pic_idx = 2;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
packet.timestamp = 2;
packet.video_header.codecHeader.VP9.picture_id = 4;
packet.video_header.codecHeader.VP9.tl0_pic_idx = 1;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
ASSERT_EQ(4UL, frames_from_callback_.size());
CheckReferencesVp9(1, 0);
@@ -1485,32 +1488,23 @@ TEST_F(TestRtpFrameReferenceFinder, Vp9PidFix_DropOldFrame) {
packet.video_header.codecHeader.VP9.temporal_up_switch = true;
packet.video_header.codecHeader.VP9.ss_data_available = true;
packet.video_header.codecHeader.VP9.gof = ss;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
packet.timestamp = 1;
packet.video_header.codecHeader.VP9.picture_id = 0;
packet.video_header.codecHeader.VP9.tl0_pic_idx = 2;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
packet.timestamp = 0;
packet.video_header.codecHeader.VP9.picture_id = 3;
packet.video_header.codecHeader.VP9.tl0_pic_idx = 2;
- {
- ref_packet_buffer_->InsertPacket(&packet);
- std::unique_ptr<RtpFrameObject> frame(
- new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0));
- reference_finder_->ManageFrame(std::move(frame));
- }
+ ref_packet_buffer_->InsertPacket(&packet);
+ reference_finder_->ManageFrame(std::unique_ptr<RtpFrameObject>(
+ new RtpFrameObject(ref_packet_buffer_, 0, 0, 0, 0, 0)));
ASSERT_EQ(2UL, frames_from_callback_.size());
CheckReferencesVp9(1, 0);
« no previous file with comments | « webrtc/modules/video_coding/rtp_frame_reference_finder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698