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

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.h

Issue 2753783002: Delete VP8 feedback mode. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 ConfigureStream(kDefaultWidth / 2, kDefaultHeight / 2, kMaxBitrates[1], 217 ConfigureStream(kDefaultWidth / 2, kDefaultHeight / 2, kMaxBitrates[1],
218 kMinBitrates[1], kTargetBitrates[1], 218 kMinBitrates[1], kTargetBitrates[1],
219 &settings->simulcastStream[1], temporal_layer_profile[1]); 219 &settings->simulcastStream[1], temporal_layer_profile[1]);
220 ConfigureStream(kDefaultWidth, kDefaultHeight, kMaxBitrates[2], 220 ConfigureStream(kDefaultWidth, kDefaultHeight, kMaxBitrates[2],
221 kMinBitrates[2], kTargetBitrates[2], 221 kMinBitrates[2], kTargetBitrates[2],
222 &settings->simulcastStream[2], temporal_layer_profile[2]); 222 &settings->simulcastStream[2], temporal_layer_profile[2]);
223 settings->VP8()->resilience = kResilientStream; 223 settings->VP8()->resilience = kResilientStream;
224 settings->VP8()->denoisingOn = true; 224 settings->VP8()->denoisingOn = true;
225 settings->VP8()->errorConcealmentOn = false; 225 settings->VP8()->errorConcealmentOn = false;
226 settings->VP8()->automaticResizeOn = false; 226 settings->VP8()->automaticResizeOn = false;
227 settings->VP8()->feedbackModeOn = false;
228 settings->VP8()->frameDroppingOn = true; 227 settings->VP8()->frameDroppingOn = true;
229 settings->VP8()->keyFrameInterval = 3000; 228 settings->VP8()->keyFrameInterval = 3000;
230 } 229 }
231 230
232 static void ConfigureStream(int width, 231 static void ConfigureStream(int width,
233 int height, 232 int height,
234 int max_bitrate, 233 int max_bitrate,
235 int min_bitrate, 234 int min_bitrate,
236 int target_bitrate, 235 int target_bitrate,
237 SimulcastStream* stream, 236 SimulcastStream* stream,
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 new VideoFrame(input_buffer_, 0, 0, webrtc::kVideoRotation_0)); 564 new VideoFrame(input_buffer_, 0, 0, webrtc::kVideoRotation_0));
566 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, &frame_types)); 565 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, &frame_types));
567 } 566 }
568 567
569 void TestSwitchingToOneStream() { SwitchingToOneStream(1024, 768); } 568 void TestSwitchingToOneStream() { SwitchingToOneStream(1024, 768); }
570 569
571 void TestSwitchingToOneOddStream() { SwitchingToOneStream(1023, 769); } 570 void TestSwitchingToOneOddStream() { SwitchingToOneStream(1023, 769); }
572 571
573 void TestSwitchingToOneSmallStream() { SwitchingToOneStream(4, 4); } 572 void TestSwitchingToOneSmallStream() { SwitchingToOneStream(4, 4); }
574 573
574 // TODO(nisse): Rename, refactor or delete test?
sprang_webrtc 2017/03/20 16:22:30 I vote delete. The other parts should already be c
nisse-webrtc 2017/03/21 07:26:02 Deleted.
575 void TestRPSIEncoder() { 575 void TestRPSIEncoder() {
576 Vp8TestEncodedImageCallback encoder_callback; 576 Vp8TestEncodedImageCallback encoder_callback;
577 encoder_->RegisterEncodeCompleteCallback(&encoder_callback); 577 encoder_->RegisterEncodeCompleteCallback(&encoder_callback);
578 578
579 SetRates(kMaxBitrates[2], 30); // To get all three streams. 579 SetRates(kMaxBitrates[2], 30); // To get all three streams.
580 580
581 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL)); 581 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL));
582 int picture_id = -1; 582 int picture_id = -1;
583 int temporal_layer = -1; 583 int temporal_layer = -1;
584 bool layer_sync = false; 584 bool layer_sync = false;
585 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer, 585 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer,
586 &layer_sync, 0); 586 &layer_sync, 0);
587 EXPECT_EQ(0, temporal_layer); 587 EXPECT_EQ(0, temporal_layer);
588 EXPECT_TRUE(layer_sync); 588 EXPECT_TRUE(layer_sync);
589 int key_frame_picture_id = picture_id;
590 589
591 input_frame_->set_timestamp(input_frame_->timestamp() + 3000); 590 input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
592 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL)); 591 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL));
593 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer, 592 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer,
594 &layer_sync, 0); 593 &layer_sync, 0);
595 EXPECT_EQ(2, temporal_layer); 594 EXPECT_EQ(2, temporal_layer);
596 EXPECT_TRUE(layer_sync); 595 EXPECT_TRUE(layer_sync);
597 596
598 input_frame_->set_timestamp(input_frame_->timestamp() + 3000); 597 input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
599 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL)); 598 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL));
600 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer, 599 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer,
601 &layer_sync, 0); 600 &layer_sync, 0);
602 EXPECT_EQ(1, temporal_layer); 601 EXPECT_EQ(1, temporal_layer);
603 EXPECT_TRUE(layer_sync); 602 EXPECT_TRUE(layer_sync);
604 603
605 input_frame_->set_timestamp(input_frame_->timestamp() + 3000); 604 input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
606 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL)); 605 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL));
607 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer, 606 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer,
608 &layer_sync, 0); 607 &layer_sync, 0);
609 EXPECT_EQ(2, temporal_layer); 608 EXPECT_EQ(2, temporal_layer);
610 EXPECT_FALSE(layer_sync); 609 EXPECT_FALSE(layer_sync);
611
612 CodecSpecificInfo codec_specific;
613 codec_specific.codecType = kVideoCodecVP8;
614 codec_specific.codecSpecific.VP8.hasReceivedRPSI = true;
615
616 // Must match last key frame to trigger.
617 codec_specific.codecSpecific.VP8.pictureIdRPSI = key_frame_picture_id;
618
619 input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
620 EXPECT_EQ(0, encoder_->Encode(*input_frame_, &codec_specific, NULL));
621 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer,
622 &layer_sync, 0);
623
624 EXPECT_EQ(0, temporal_layer);
625 EXPECT_TRUE(layer_sync);
626
627 // Must match last key frame to trigger, test bad id.
628 codec_specific.codecSpecific.VP8.pictureIdRPSI = key_frame_picture_id + 17;
629
630 input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
631 EXPECT_EQ(0, encoder_->Encode(*input_frame_, &codec_specific, NULL));
632 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer,
633 &layer_sync, 0);
634
635 EXPECT_EQ(2, temporal_layer);
636 // The previous frame was a base layer sync (since it was a frame that
637 // only predicts from key frame and hence resets the temporal pattern),
638 // so this frame (the next one) must have |layer_sync| set to true.
639 EXPECT_TRUE(layer_sync);
640 } 610 }
641 611
612 // TODO(nisse): Rename, refactor or delete test?
sprang_webrtc 2017/03/20 16:22:30 Ditto
nisse-webrtc 2017/03/21 07:26:02 Also deleted.
642 void TestRPSIEncodeDecode() { 613 void TestRPSIEncodeDecode() {
643 Vp8TestEncodedImageCallback encoder_callback; 614 Vp8TestEncodedImageCallback encoder_callback;
644 Vp8TestDecodedImageCallback decoder_callback; 615 Vp8TestDecodedImageCallback decoder_callback;
645 encoder_->RegisterEncodeCompleteCallback(&encoder_callback); 616 encoder_->RegisterEncodeCompleteCallback(&encoder_callback);
646 decoder_->RegisterDecodeCompleteCallback(&decoder_callback); 617 decoder_->RegisterDecodeCompleteCallback(&decoder_callback);
647 618
648 SetRates(kMaxBitrates[2], 30); // To get all three streams. 619 SetRates(kMaxBitrates[2], 30); // To get all three streams.
649 620
650 // Set color. 621 // Set color.
651 int plane_offset[kNumOfPlanes]; 622 int plane_offset[kNumOfPlanes];
652 plane_offset[kYPlane] = kColorY; 623 plane_offset[kYPlane] = kColorY;
653 plane_offset[kUPlane] = kColorU; 624 plane_offset[kUPlane] = kColorU;
654 plane_offset[kVPlane] = kColorV; 625 plane_offset[kVPlane] = kColorV;
655 CreateImage(input_buffer_, plane_offset); 626 CreateImage(input_buffer_, plane_offset);
656 627
657 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL)); 628 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL));
658 int picture_id = -1; 629 int picture_id = -1;
659 int temporal_layer = -1; 630 int temporal_layer = -1;
660 bool layer_sync = false; 631 bool layer_sync = false;
661 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer, 632 encoder_callback.GetLastEncodedFrameInfo(&picture_id, &temporal_layer,
662 &layer_sync, 0); 633 &layer_sync, 0);
663 EXPECT_EQ(0, temporal_layer); 634 EXPECT_EQ(0, temporal_layer);
664 EXPECT_TRUE(layer_sync); 635 EXPECT_TRUE(layer_sync);
665 int key_frame_picture_id = picture_id;
666 636
667 // Change color. 637 // Change color.
668 plane_offset[kYPlane] += 1; 638 plane_offset[kYPlane] += 1;
669 plane_offset[kUPlane] += 1; 639 plane_offset[kUPlane] += 1;
670 plane_offset[kVPlane] += 1; 640 plane_offset[kVPlane] += 1;
671 CreateImage(input_buffer_, plane_offset); 641 CreateImage(input_buffer_, plane_offset);
672 input_frame_->set_timestamp(input_frame_->timestamp() + 3000); 642 input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
673 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL)); 643 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL));
674 644
675 // Change color. 645 // Change color.
676 plane_offset[kYPlane] += 1; 646 plane_offset[kYPlane] += 1;
677 plane_offset[kUPlane] += 1; 647 plane_offset[kUPlane] += 1;
678 plane_offset[kVPlane] += 1; 648 plane_offset[kVPlane] += 1;
679 CreateImage(input_buffer_, plane_offset); 649 CreateImage(input_buffer_, plane_offset);
680 650
681 input_frame_->set_timestamp(input_frame_->timestamp() + 3000); 651 input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
682 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL)); 652 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL));
683 653
684 // Change color. 654 // Change color.
685 plane_offset[kYPlane] += 1; 655 plane_offset[kYPlane] += 1;
686 plane_offset[kUPlane] += 1; 656 plane_offset[kUPlane] += 1;
687 plane_offset[kVPlane] += 1; 657 plane_offset[kVPlane] += 1;
688 CreateImage(input_buffer_, plane_offset); 658 CreateImage(input_buffer_, plane_offset);
689 659
690 input_frame_->set_timestamp(input_frame_->timestamp() + 3000); 660 input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
691 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL)); 661 EXPECT_EQ(0, encoder_->Encode(*input_frame_, NULL, NULL));
692
693 CodecSpecificInfo codec_specific;
694 codec_specific.codecType = kVideoCodecVP8;
695 codec_specific.codecSpecific.VP8.hasReceivedRPSI = true;
696 // Must match last key frame to trigger.
697 codec_specific.codecSpecific.VP8.pictureIdRPSI = key_frame_picture_id;
698
699 // Change color back to original.
700 plane_offset[kYPlane] = kColorY;
701 plane_offset[kUPlane] = kColorU;
702 plane_offset[kVPlane] = kColorV;
703 CreateImage(input_buffer_, plane_offset);
704
705 input_frame_->set_timestamp(input_frame_->timestamp() + 3000);
706 EXPECT_EQ(0, encoder_->Encode(*input_frame_, &codec_specific, NULL));
707
708 EncodedImage encoded_frame;
709 encoder_callback.GetLastEncodedKeyFrame(&encoded_frame);
710 decoder_->Decode(encoded_frame, false, NULL);
711 encoder_callback.GetLastEncodedFrame(&encoded_frame);
712 decoder_->Decode(encoded_frame, false, NULL);
713 EXPECT_EQ(2, decoder_callback.DecodedFrames());
714 } 662 }
715 663
716 // Test the layer pattern and sync flag for various spatial-temporal patterns. 664 // Test the layer pattern and sync flag for various spatial-temporal patterns.
717 // 3-3-3 pattern: 3 temporal layers for all spatial streams, so same 665 // 3-3-3 pattern: 3 temporal layers for all spatial streams, so same
718 // temporal_layer id and layer_sync is expected for all streams. 666 // temporal_layer id and layer_sync is expected for all streams.
719 void TestSaptioTemporalLayers333PatternEncoder() { 667 void TestSaptioTemporalLayers333PatternEncoder() {
720 Vp8TestEncodedImageCallback encoder_callback; 668 Vp8TestEncodedImageCallback encoder_callback;
721 encoder_->RegisterEncodeCompleteCallback(&encoder_callback); 669 encoder_->RegisterEncodeCompleteCallback(&encoder_callback);
722 SetRates(kMaxBitrates[2], 30); // To get all three streams. 670 SetRates(kMaxBitrates[2], 30); // To get all three streams.
723 671
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 VideoCodec settings_; 838 VideoCodec settings_;
891 rtc::scoped_refptr<I420Buffer> input_buffer_; 839 rtc::scoped_refptr<I420Buffer> input_buffer_;
892 std::unique_ptr<VideoFrame> input_frame_; 840 std::unique_ptr<VideoFrame> input_frame_;
893 std::unique_ptr<SimulcastRateAllocator> rate_allocator_; 841 std::unique_ptr<SimulcastRateAllocator> rate_allocator_;
894 }; 842 };
895 843
896 } // namespace testing 844 } // namespace testing
897 } // namespace webrtc 845 } // namespace webrtc
898 846
899 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_ 847 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP8_SIMULCAST_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698