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

Side by Side Diff: webrtc/video/vie_encoder_unittest.cc

Issue 2801293002: Add some unit tests to vie_encoder. (Closed)
Patch Set: address comment Created 3 years, 8 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
« no previous file with comments | « webrtc/video/vie_encoder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 277
278 VideoFrame CreateFrame(int64_t ntp_time_ms, int width, int height) const { 278 VideoFrame CreateFrame(int64_t ntp_time_ms, int width, int height) const {
279 VideoFrame frame( 279 VideoFrame frame(
280 new rtc::RefCountedObject<TestBuffer>(nullptr, width, height), 99, 99, 280 new rtc::RefCountedObject<TestBuffer>(nullptr, width, height), 99, 99,
281 kVideoRotation_0); 281 kVideoRotation_0);
282 frame.set_ntp_time_ms(ntp_time_ms); 282 frame.set_ntp_time_ms(ntp_time_ms);
283 frame.set_timestamp_us(ntp_time_ms * 1000); 283 frame.set_timestamp_us(ntp_time_ms * 1000);
284 return frame; 284 return frame;
285 } 285 }
286 286
287 void VerifyNoLimitation(const rtc::VideoSinkWants& wants) {
288 EXPECT_FALSE(wants.target_pixel_count);
289 EXPECT_EQ(std::numeric_limits<int>::max(), wants.max_pixel_count);
290 EXPECT_EQ(std::numeric_limits<int>::max(), wants.max_framerate_fps);
291 }
292
293 void VerifyResolutionLimitationLessThan(const rtc::VideoSinkWants& wants,
294 int pixel_count) {
295 EXPECT_LT(wants.max_pixel_count, pixel_count);
296 EXPECT_GT(wants.max_pixel_count, 0);
297 EXPECT_EQ(std::numeric_limits<int>::max(), wants.max_framerate_fps);
298 }
299
287 class TestEncoder : public test::FakeEncoder { 300 class TestEncoder : public test::FakeEncoder {
288 public: 301 public:
289 TestEncoder() 302 TestEncoder()
290 : FakeEncoder(Clock::GetRealTimeClock()), 303 : FakeEncoder(Clock::GetRealTimeClock()),
291 continue_encode_event_(false, false) {} 304 continue_encode_event_(false, false) {}
292 305
293 VideoCodec codec_config() const { 306 VideoCodec codec_config() const {
294 rtc::CritScope lock(&crit_sect_); 307 rtc::CritScope lock(&crit_sect_);
295 return config_; 308 return config_;
296 } 309 }
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 TEST_F(ViEEncoderTest, SinkWantsRotationApplied) { 721 TEST_F(ViEEncoderTest, SinkWantsRotationApplied) {
709 EXPECT_FALSE(video_source_.sink_wants().rotation_applied); 722 EXPECT_FALSE(video_source_.sink_wants().rotation_applied);
710 vie_encoder_->SetSink(&sink_, true /*rotation_applied*/); 723 vie_encoder_->SetSink(&sink_, true /*rotation_applied*/);
711 EXPECT_TRUE(video_source_.sink_wants().rotation_applied); 724 EXPECT_TRUE(video_source_.sink_wants().rotation_applied);
712 vie_encoder_->Stop(); 725 vie_encoder_->Stop();
713 } 726 }
714 727
715 TEST_F(ViEEncoderTest, SinkWantsFromOveruseDetector) { 728 TEST_F(ViEEncoderTest, SinkWantsFromOveruseDetector) {
716 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 729 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
717 730
718 EXPECT_FALSE(video_source_.sink_wants().target_pixel_count); 731 VerifyNoLimitation(video_source_.sink_wants());
719 EXPECT_EQ(std::numeric_limits<int>::max(),
720 video_source_.sink_wants().max_pixel_count);
721 732
722 int frame_width = 1280; 733 int frame_width = 1280;
723 int frame_height = 720; 734 int frame_height = 720;
724 735
725 // Trigger CPU overuse kMaxCpuDowngrades times. Every time, ViEEncoder should 736 // Trigger CPU overuse kMaxCpuDowngrades times. Every time, ViEEncoder should
726 // request lower resolution. 737 // request lower resolution.
727 for (int i = 1; i <= ViEEncoder::kMaxCpuResolutionDowngrades; ++i) { 738 for (int i = 1; i <= ViEEncoder::kMaxCpuResolutionDowngrades; ++i) {
728 video_source_.IncomingCapturedFrame( 739 video_source_.IncomingCapturedFrame(
729 CreateFrame(i, frame_width, frame_height)); 740 CreateFrame(i, frame_width, frame_height));
730 sink_.WaitForEncodedFrame(i); 741 sink_.WaitForEncodedFrame(i);
(...skipping 25 matching lines...) Expand all
756 EXPECT_EQ(frame_width * frame_height * 5 / 3, 767 EXPECT_EQ(frame_width * frame_height * 5 / 3,
757 video_source_.sink_wants().target_pixel_count.value_or(0)); 768 video_source_.sink_wants().target_pixel_count.value_or(0));
758 EXPECT_EQ(frame_width * frame_height * 4, 769 EXPECT_EQ(frame_width * frame_height * 4,
759 video_source_.sink_wants().max_pixel_count); 770 video_source_.sink_wants().max_pixel_count);
760 771
761 vie_encoder_->Stop(); 772 vie_encoder_->Stop();
762 } 773 }
763 774
764 TEST_F(ViEEncoderTest, SinkWantsStoredByDegradationPreference) { 775 TEST_F(ViEEncoderTest, SinkWantsStoredByDegradationPreference) {
765 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 776 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
766 777 VerifyNoLimitation(video_source_.sink_wants());
767 EXPECT_FALSE(video_source_.sink_wants().target_pixel_count);
768 EXPECT_EQ(std::numeric_limits<int>::max(),
769 video_source_.sink_wants().max_pixel_count);
770 EXPECT_EQ(std::numeric_limits<int>::max(),
771 video_source_.sink_wants().max_framerate_fps);
772 778
773 const int kFrameWidth = 1280; 779 const int kFrameWidth = 1280;
774 const int kFrameHeight = 720; 780 const int kFrameHeight = 720;
775 const int kFrameIntervalMs = 1000 / 30; 781 const int kFrameIntervalMs = 1000 / 30;
776 782
777 int frame_timestamp = 1; 783 int frame_timestamp = 1;
778 784
779 video_source_.IncomingCapturedFrame( 785 video_source_.IncomingCapturedFrame(
780 CreateFrame(frame_timestamp, kFrameWidth, kFrameHeight)); 786 CreateFrame(frame_timestamp, kFrameWidth, kFrameHeight));
781 sink_.WaitForEncodedFrame(frame_timestamp); 787 sink_.WaitForEncodedFrame(frame_timestamp);
(...skipping 14 matching lines...) Expand all
796 EXPECT_EQ(std::numeric_limits<int>::max(), 802 EXPECT_EQ(std::numeric_limits<int>::max(),
797 video_source_.sink_wants().max_framerate_fps); 803 video_source_.sink_wants().max_framerate_fps);
798 804
799 // Set new source, switch to maintain-resolution. 805 // Set new source, switch to maintain-resolution.
800 test::FrameForwarder new_video_source; 806 test::FrameForwarder new_video_source;
801 vie_encoder_->SetSource( 807 vie_encoder_->SetSource(
802 &new_video_source, 808 &new_video_source,
803 VideoSendStream::DegradationPreference::kMaintainResolution); 809 VideoSendStream::DegradationPreference::kMaintainResolution);
804 810
805 // Initially no degradation registered. 811 // Initially no degradation registered.
806 EXPECT_FALSE(new_video_source.sink_wants().target_pixel_count); 812 VerifyNoLimitation(new_video_source.sink_wants());
807 EXPECT_EQ(std::numeric_limits<int>::max(),
808 new_video_source.sink_wants().max_pixel_count);
809 EXPECT_EQ(std::numeric_limits<int>::max(),
810 new_video_source.sink_wants().max_framerate_fps);
811 813
812 // Force an input frame rate to be available, or the adaptation call won't 814 // Force an input frame rate to be available, or the adaptation call won't
813 // know what framerate to adapt form. 815 // know what framerate to adapt form.
816 const int kInputFps = 30;
814 VideoSendStream::Stats stats = stats_proxy_->GetStats(); 817 VideoSendStream::Stats stats = stats_proxy_->GetStats();
815 stats.input_frame_rate = 30; 818 stats.input_frame_rate = kInputFps;
816 stats_proxy_->SetMockStats(stats); 819 stats_proxy_->SetMockStats(stats);
817 820
818 vie_encoder_->TriggerCpuOveruse(); 821 vie_encoder_->TriggerCpuOveruse();
819 new_video_source.IncomingCapturedFrame( 822 new_video_source.IncomingCapturedFrame(
820 CreateFrame(frame_timestamp, kFrameWidth, kFrameHeight)); 823 CreateFrame(frame_timestamp, kFrameWidth, kFrameHeight));
821 sink_.WaitForEncodedFrame(frame_timestamp); 824 sink_.WaitForEncodedFrame(frame_timestamp);
822 frame_timestamp += kFrameIntervalMs; 825 frame_timestamp += kFrameIntervalMs;
823 826
824 // Some framerate constraint should be set. 827 // Some framerate constraint should be set.
825 EXPECT_FALSE(new_video_source.sink_wants().target_pixel_count); 828 EXPECT_FALSE(new_video_source.sink_wants().target_pixel_count);
826 EXPECT_EQ(std::numeric_limits<int>::max(), 829 EXPECT_EQ(std::numeric_limits<int>::max(),
827 new_video_source.sink_wants().max_pixel_count); 830 new_video_source.sink_wants().max_pixel_count);
828 EXPECT_TRUE(new_video_source.sink_wants().max_framerate_fps); 831 EXPECT_LT(new_video_source.sink_wants().max_framerate_fps, kInputFps);
829 832
830 // Turn of degradation completely. 833 // Turn off degradation completely.
831 vie_encoder_->SetSource( 834 vie_encoder_->SetSource(
832 &new_video_source, 835 &new_video_source,
833 VideoSendStream::DegradationPreference::kDegradationDisabled); 836 VideoSendStream::DegradationPreference::kDegradationDisabled);
834 837 VerifyNoLimitation(new_video_source.sink_wants());
835 // Initially no degradation registered.
836 EXPECT_FALSE(new_video_source.sink_wants().target_pixel_count);
837 EXPECT_EQ(std::numeric_limits<int>::max(),
838 new_video_source.sink_wants().max_pixel_count);
839 EXPECT_EQ(std::numeric_limits<int>::max(),
840 new_video_source.sink_wants().max_framerate_fps);
841 838
842 vie_encoder_->TriggerCpuOveruse(); 839 vie_encoder_->TriggerCpuOveruse();
843 new_video_source.IncomingCapturedFrame( 840 new_video_source.IncomingCapturedFrame(
844 CreateFrame(frame_timestamp, kFrameWidth, kFrameHeight)); 841 CreateFrame(frame_timestamp, kFrameWidth, kFrameHeight));
845 sink_.WaitForEncodedFrame(frame_timestamp); 842 sink_.WaitForEncodedFrame(frame_timestamp);
846 frame_timestamp += kFrameIntervalMs; 843 frame_timestamp += kFrameIntervalMs;
847 844
848 // Still no degradation. 845 // Still no degradation.
849 EXPECT_FALSE(new_video_source.sink_wants().target_pixel_count); 846 VerifyNoLimitation(new_video_source.sink_wants());
850 EXPECT_EQ(std::numeric_limits<int>::max(),
851 new_video_source.sink_wants().max_pixel_count);
852 EXPECT_EQ(std::numeric_limits<int>::max(),
853 new_video_source.sink_wants().max_framerate_fps);
854 847
855 // Calling SetSource with resolution scaling enabled apply the old SinkWants. 848 // Calling SetSource with resolution scaling enabled apply the old SinkWants.
856 vie_encoder_->SetSource( 849 vie_encoder_->SetSource(
857 &new_video_source, 850 &new_video_source,
858 VideoSendStream::DegradationPreference::kMaintainFramerate); 851 VideoSendStream::DegradationPreference::kMaintainFramerate);
859 EXPECT_LT(new_video_source.sink_wants().max_pixel_count, 852 EXPECT_LT(new_video_source.sink_wants().max_pixel_count,
860 kFrameWidth * kFrameHeight); 853 kFrameWidth * kFrameHeight);
861 EXPECT_FALSE(new_video_source.sink_wants().target_pixel_count); 854 EXPECT_FALSE(new_video_source.sink_wants().target_pixel_count);
862 EXPECT_EQ(std::numeric_limits<int>::max(), 855 EXPECT_EQ(std::numeric_limits<int>::max(),
863 new_video_source.sink_wants().max_framerate_fps); 856 new_video_source.sink_wants().max_framerate_fps);
864 857
865 // Calling SetSource with framerate scaling enabled apply the old SinkWants. 858 // Calling SetSource with framerate scaling enabled apply the old SinkWants.
866 vie_encoder_->SetSource( 859 vie_encoder_->SetSource(
867 &new_video_source, 860 &new_video_source,
868 VideoSendStream::DegradationPreference::kMaintainResolution); 861 VideoSendStream::DegradationPreference::kMaintainResolution);
869 EXPECT_FALSE(new_video_source.sink_wants().target_pixel_count); 862 EXPECT_FALSE(new_video_source.sink_wants().target_pixel_count);
870 EXPECT_EQ(std::numeric_limits<int>::max(), 863 EXPECT_EQ(std::numeric_limits<int>::max(),
871 new_video_source.sink_wants().max_pixel_count); 864 new_video_source.sink_wants().max_pixel_count);
872 EXPECT_TRUE(new_video_source.sink_wants().max_framerate_fps); 865 EXPECT_LT(new_video_source.sink_wants().max_framerate_fps, kInputFps);
873 866
874 vie_encoder_->Stop(); 867 vie_encoder_->Stop();
875 } 868 }
876 869
877 TEST_F(ViEEncoderTest, StatsTracksQualityAdaptationStats) { 870 TEST_F(ViEEncoderTest, StatsTracksQualityAdaptationStats) {
878 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 871 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
879 872
880 const int kWidth = 1280; 873 const int kWidth = 1280;
881 const int kHeight = 720; 874 const int kHeight = 720;
882
883 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight)); 875 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
884 sink_.WaitForEncodedFrame(1); 876 sink_.WaitForEncodedFrame(1);
885 VideoSendStream::Stats stats = stats_proxy_->GetStats(); 877 VideoSendStream::Stats stats = stats_proxy_->GetStats();
886 EXPECT_FALSE(stats.bw_limited_resolution); 878 EXPECT_FALSE(stats.bw_limited_resolution);
887 EXPECT_EQ(0, stats.number_of_quality_adapt_changes); 879 EXPECT_EQ(0, stats.number_of_quality_adapt_changes);
888 880
889 // Trigger adapt down. 881 // Trigger adapt down.
890 vie_encoder_->TriggerQualityLow(); 882 vie_encoder_->TriggerQualityLow();
891 video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight)); 883 video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
892 sink_.WaitForEncodedFrame(2); 884 sink_.WaitForEncodedFrame(2);
(...skipping 13 matching lines...) Expand all
906 EXPECT_EQ(0, stats.number_of_cpu_adapt_changes); 898 EXPECT_EQ(0, stats.number_of_cpu_adapt_changes);
907 899
908 vie_encoder_->Stop(); 900 vie_encoder_->Stop();
909 } 901 }
910 902
911 TEST_F(ViEEncoderTest, StatsTracksCpuAdaptationStats) { 903 TEST_F(ViEEncoderTest, StatsTracksCpuAdaptationStats) {
912 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 904 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
913 905
914 const int kWidth = 1280; 906 const int kWidth = 1280;
915 const int kHeight = 720; 907 const int kHeight = 720;
916
917 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight)); 908 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
918 sink_.WaitForEncodedFrame(1); 909 sink_.WaitForEncodedFrame(1);
919 VideoSendStream::Stats stats = stats_proxy_->GetStats(); 910 VideoSendStream::Stats stats = stats_proxy_->GetStats();
920 EXPECT_FALSE(stats.cpu_limited_resolution); 911 EXPECT_FALSE(stats.cpu_limited_resolution);
921 EXPECT_EQ(0, stats.number_of_cpu_adapt_changes); 912 EXPECT_EQ(0, stats.number_of_cpu_adapt_changes);
922 913
923 // Trigger CPU overuse. 914 // Trigger CPU overuse.
924 vie_encoder_->TriggerCpuOveruse(); 915 vie_encoder_->TriggerCpuOveruse();
925 video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight)); 916 video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
926 sink_.WaitForEncodedFrame(2); 917 sink_.WaitForEncodedFrame(2);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 EXPECT_TRUE(stats.cpu_limited_resolution); 986 EXPECT_TRUE(stats.cpu_limited_resolution);
996 EXPECT_EQ(1, stats.number_of_cpu_adapt_changes); 987 EXPECT_EQ(1, stats.number_of_cpu_adapt_changes);
997 988
998 // Trigger CPU normal use. 989 // Trigger CPU normal use.
999 vie_encoder_->TriggerCpuNormalUsage(); 990 vie_encoder_->TriggerCpuNormalUsage();
1000 new_video_source.IncomingCapturedFrame(CreateFrame(6, kWidth, kHeight)); 991 new_video_source.IncomingCapturedFrame(CreateFrame(6, kWidth, kHeight));
1001 sink_.WaitForEncodedFrame(6); 992 sink_.WaitForEncodedFrame(6);
1002 stats = stats_proxy_->GetStats(); 993 stats = stats_proxy_->GetStats();
1003 EXPECT_FALSE(stats.cpu_limited_resolution); 994 EXPECT_FALSE(stats.cpu_limited_resolution);
1004 EXPECT_EQ(2, stats.number_of_cpu_adapt_changes); 995 EXPECT_EQ(2, stats.number_of_cpu_adapt_changes);
996 EXPECT_EQ(0, stats.number_of_quality_adapt_changes);
1005 997
1006 vie_encoder_->Stop(); 998 vie_encoder_->Stop();
1007 } 999 }
1008 1000
1009 TEST_F(ViEEncoderTest, SwitchingSourceKeepsQualityAdaptation) { 1001 TEST_F(ViEEncoderTest, SwitchingSourceKeepsQualityAdaptation) {
1010 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 1002 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1011 1003
1012 const int kWidth = 1280; 1004 const int kWidth = 1280;
1013 const int kHeight = 720; 1005 const int kHeight = 720;
1014 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight)); 1006 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
(...skipping 28 matching lines...) Expand all
1043 vie_encoder_->SetSource(&new_video_source, 1035 vie_encoder_->SetSource(&new_video_source,
1044 VideoSendStream::DegradationPreference::kBalanced); 1036 VideoSendStream::DegradationPreference::kBalanced);
1045 1037
1046 new_video_source.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight)); 1038 new_video_source.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight));
1047 sink_.WaitForEncodedFrame(4); 1039 sink_.WaitForEncodedFrame(4);
1048 stats = stats_proxy_->GetStats(); 1040 stats = stats_proxy_->GetStats();
1049 EXPECT_FALSE(stats.cpu_limited_resolution); 1041 EXPECT_FALSE(stats.cpu_limited_resolution);
1050 EXPECT_TRUE(stats.bw_limited_resolution); 1042 EXPECT_TRUE(stats.bw_limited_resolution);
1051 EXPECT_EQ(1, stats.number_of_quality_adapt_changes); 1043 EXPECT_EQ(1, stats.number_of_quality_adapt_changes);
1052 1044
1053 // Set adaptation disabled. 1045 // Disable resolution scaling.
1054 vie_encoder_->SetSource( 1046 vie_encoder_->SetSource(
1055 &new_video_source, 1047 &new_video_source,
1056 VideoSendStream::DegradationPreference::kMaintainResolution); 1048 VideoSendStream::DegradationPreference::kMaintainResolution);
1057 1049
1058 new_video_source.IncomingCapturedFrame(CreateFrame(5, kWidth, kHeight)); 1050 new_video_source.IncomingCapturedFrame(CreateFrame(5, kWidth, kHeight));
1059 sink_.WaitForEncodedFrame(5); 1051 sink_.WaitForEncodedFrame(5);
1060 stats = stats_proxy_->GetStats(); 1052 stats = stats_proxy_->GetStats();
1061 EXPECT_FALSE(stats.cpu_limited_resolution); 1053 EXPECT_FALSE(stats.cpu_limited_resolution);
1062 EXPECT_FALSE(stats.bw_limited_resolution); 1054 EXPECT_FALSE(stats.bw_limited_resolution);
1063 EXPECT_EQ(1, stats.number_of_quality_adapt_changes); 1055 EXPECT_EQ(1, stats.number_of_quality_adapt_changes);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 1094
1103 video_source_.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight)); 1095 video_source_.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight));
1104 sink_.WaitForEncodedFrame(4); 1096 sink_.WaitForEncodedFrame(4);
1105 EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution); 1097 EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
1106 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution); 1098 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
1107 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes); 1099 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
1108 1100
1109 vie_encoder_->Stop(); 1101 vie_encoder_->Stop();
1110 } 1102 }
1111 1103
1112 TEST_F(ViEEncoderTest, StatsTracksAdaptationStatsWhenSwitchingSource) { 1104 TEST_F(ViEEncoderTest, StatsTracksCpuAdaptationStatsWhenSwitchingSource) {
1113 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 1105 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1114 1106
1115 const int kWidth = 1280; 1107 const int kWidth = 1280;
1116 const int kHeight = 720; 1108 const int kHeight = 720;
1117 int sequence = 1; 1109 int sequence = 1;
1118 1110
1119 video_source_.IncomingCapturedFrame(CreateFrame(sequence, kWidth, kHeight)); 1111 video_source_.IncomingCapturedFrame(CreateFrame(sequence, kWidth, kHeight));
1120 sink_.WaitForEncodedFrame(sequence++); 1112 sink_.WaitForEncodedFrame(sequence++);
1121
1122 VideoSendStream::Stats stats = stats_proxy_->GetStats(); 1113 VideoSendStream::Stats stats = stats_proxy_->GetStats();
1123 EXPECT_FALSE(stats.cpu_limited_resolution); 1114 EXPECT_FALSE(stats.cpu_limited_resolution);
1124 EXPECT_EQ(0, stats.number_of_cpu_adapt_changes); 1115 EXPECT_EQ(0, stats.number_of_cpu_adapt_changes);
1125 1116
1126 // Trigger CPU overuse again, should now adapt down. 1117 // Trigger CPU overuse, should now adapt down.
1127 vie_encoder_->TriggerCpuOveruse(); 1118 vie_encoder_->TriggerCpuOveruse();
1128 video_source_.IncomingCapturedFrame(CreateFrame(sequence, kWidth, kHeight)); 1119 video_source_.IncomingCapturedFrame(CreateFrame(sequence, kWidth, kHeight));
1129 sink_.WaitForEncodedFrame(sequence++); 1120 sink_.WaitForEncodedFrame(sequence++);
1130
1131 stats = stats_proxy_->GetStats(); 1121 stats = stats_proxy_->GetStats();
1132 EXPECT_TRUE(stats.cpu_limited_resolution); 1122 EXPECT_TRUE(stats.cpu_limited_resolution);
1133 EXPECT_EQ(1, stats.number_of_cpu_adapt_changes); 1123 EXPECT_EQ(1, stats.number_of_cpu_adapt_changes);
1134 1124
1135 // Set new source with adaptation still enabled. 1125 // Set new source with adaptation still enabled.
1136 test::FrameForwarder new_video_source; 1126 test::FrameForwarder new_video_source;
1137 vie_encoder_->SetSource( 1127 vie_encoder_->SetSource(
1138 &new_video_source, 1128 &new_video_source,
1139 VideoSendStream::DegradationPreference::kMaintainFramerate); 1129 VideoSendStream::DegradationPreference::kMaintainFramerate);
1140 1130
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 EXPECT_EQ(3, stats.number_of_cpu_adapt_changes); 1216 EXPECT_EQ(3, stats.number_of_cpu_adapt_changes);
1227 1217
1228 // Trigger CPU normal usage. 1218 // Trigger CPU normal usage.
1229 vie_encoder_->TriggerCpuNormalUsage(); 1219 vie_encoder_->TriggerCpuNormalUsage();
1230 new_video_source.IncomingCapturedFrame( 1220 new_video_source.IncomingCapturedFrame(
1231 CreateFrame(sequence, kWidth, kHeight)); 1221 CreateFrame(sequence, kWidth, kHeight));
1232 sink_.WaitForEncodedFrame(sequence++); 1222 sink_.WaitForEncodedFrame(sequence++);
1233 stats = stats_proxy_->GetStats(); 1223 stats = stats_proxy_->GetStats();
1234 EXPECT_FALSE(stats.cpu_limited_resolution); 1224 EXPECT_FALSE(stats.cpu_limited_resolution);
1235 EXPECT_EQ(4, stats.number_of_cpu_adapt_changes); 1225 EXPECT_EQ(4, stats.number_of_cpu_adapt_changes);
1226 EXPECT_EQ(0, stats.number_of_quality_adapt_changes);
1236 1227
1237 vie_encoder_->Stop(); 1228 vie_encoder_->Stop();
1238 } 1229 }
1239 1230
1240 TEST_F(ViEEncoderTest, StatsTracksPreferredBitrate) { 1231 TEST_F(ViEEncoderTest, StatsTracksPreferredBitrate) {
1241 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 1232 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1242 1233
1243 const int kWidth = 1280; 1234 const int kWidth = 1280;
1244 const int kHeight = 720; 1235 const int kHeight = 720;
1245 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight)); 1236 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
1246 sink_.WaitForEncodedFrame(1); 1237 sink_.WaitForEncodedFrame(1);
1247 1238
1248 VideoSendStream::Stats stats = stats_proxy_->GetStats(); 1239 VideoSendStream::Stats stats = stats_proxy_->GetStats();
1249 EXPECT_EQ(video_encoder_config_.max_bitrate_bps, 1240 EXPECT_EQ(video_encoder_config_.max_bitrate_bps,
1250 stats.preferred_media_bitrate_bps); 1241 stats.preferred_media_bitrate_bps);
1251 1242
1252 vie_encoder_->Stop(); 1243 vie_encoder_->Stop();
1253 } 1244 }
1254 1245
1255 TEST_F(ViEEncoderTest, ScalingUpAndDownDoesNothingWithMaintainResolution) { 1246 TEST_F(ViEEncoderTest, ScalingUpAndDownDoesNothingWithMaintainResolution) {
1256 const int kWidth = 1280; 1247 const int kWidth = 1280;
1257 const int kHeight = 720; 1248 const int kHeight = 720;
1258 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 1249 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1259 1250
1260 // Expect no scaling to begin with. 1251 // Expect no scaling to begin with.
1261 EXPECT_FALSE(video_source_.sink_wants().target_pixel_count); 1252 VerifyNoLimitation(video_source_.sink_wants());
1262 EXPECT_EQ(std::numeric_limits<int>::max(),
1263 video_source_.sink_wants().max_pixel_count);
1264 1253
1265 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight)); 1254 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
1266 sink_.WaitForEncodedFrame(1); 1255 sink_.WaitForEncodedFrame(1);
1267 1256
1268 // Trigger scale down. 1257 // Trigger scale down.
1269 vie_encoder_->TriggerQualityLow(); 1258 vie_encoder_->TriggerQualityLow();
1270 1259
1271 video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight)); 1260 video_source_.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
1272 sink_.WaitForEncodedFrame(2); 1261 sink_.WaitForEncodedFrame(2);
1273 1262
1274 // Expect a scale down. 1263 // Expect a scale down.
1275 EXPECT_TRUE(video_source_.sink_wants().max_pixel_count); 1264 EXPECT_TRUE(video_source_.sink_wants().max_pixel_count);
1276 EXPECT_LT(video_source_.sink_wants().max_pixel_count, kWidth * kHeight); 1265 EXPECT_LT(video_source_.sink_wants().max_pixel_count, kWidth * kHeight);
1277 1266
1278 // Set adaptation disabled. 1267 // Set resolution scaling disabled.
1279 test::FrameForwarder new_video_source; 1268 test::FrameForwarder new_video_source;
1280 vie_encoder_->SetSource( 1269 vie_encoder_->SetSource(
1281 &new_video_source, 1270 &new_video_source,
1282 VideoSendStream::DegradationPreference::kMaintainResolution); 1271 VideoSendStream::DegradationPreference::kMaintainResolution);
1283 1272
1284 // Trigger scale down. 1273 // Trigger scale down.
1285 vie_encoder_->TriggerQualityLow(); 1274 vie_encoder_->TriggerQualityLow();
1286 new_video_source.IncomingCapturedFrame(CreateFrame(3, kWidth, kHeight)); 1275 new_video_source.IncomingCapturedFrame(CreateFrame(3, kWidth, kHeight));
1287 sink_.WaitForEncodedFrame(3); 1276 sink_.WaitForEncodedFrame(3);
1288 1277
1289 // Expect no scaling. 1278 // Expect no scaling.
1290 EXPECT_EQ(std::numeric_limits<int>::max(), 1279 EXPECT_EQ(std::numeric_limits<int>::max(),
1291 new_video_source.sink_wants().max_pixel_count); 1280 new_video_source.sink_wants().max_pixel_count);
1292 1281
1293 // Trigger scale up. 1282 // Trigger scale up.
1294 vie_encoder_->TriggerQualityHigh(); 1283 vie_encoder_->TriggerQualityHigh();
1295 new_video_source.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight)); 1284 new_video_source.IncomingCapturedFrame(CreateFrame(4, kWidth, kHeight));
1296 sink_.WaitForEncodedFrame(4); 1285 sink_.WaitForEncodedFrame(4);
1297 1286
1298 // Expect nothing to change, still no scaling 1287 // Expect nothing to change, still no scaling.
1299 EXPECT_EQ(std::numeric_limits<int>::max(), 1288 EXPECT_EQ(std::numeric_limits<int>::max(),
1300 new_video_source.sink_wants().max_pixel_count); 1289 new_video_source.sink_wants().max_pixel_count);
1301 1290
1302 vie_encoder_->Stop(); 1291 vie_encoder_->Stop();
1303 } 1292 }
1304 1293
1294 TEST_F(ViEEncoderTest, SkipsSameAdaptDownRequest_MaintainFramerateMode) {
1295 const int kWidth = 1280;
1296 const int kHeight = 720;
1297 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1298
1299 // Enable kMaintainFramerate preference, no initial limitation.
1300 test::FrameForwarder source;
1301 vie_encoder_->SetSource(
1302 &source, VideoSendStream::DegradationPreference::kMaintainFramerate);
1303
1304 source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
1305 sink_.WaitForEncodedFrame(1);
1306 VerifyNoLimitation(source.sink_wants());
1307 EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
1308 EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
1309
1310 // Trigger adapt down, expect scaled down resolution.
1311 vie_encoder_->TriggerCpuOveruse();
1312 VerifyResolutionLimitationLessThan(source.sink_wants(), kWidth * kHeight);
1313 const int kLastMaxPixelCount = source.sink_wants().max_pixel_count;
1314 EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
1315 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
1316
1317 // Trigger adapt down for same input resolution, expect no change.
1318 vie_encoder_->TriggerCpuOveruse();
1319 EXPECT_EQ(kLastMaxPixelCount, source.sink_wants().max_pixel_count);
1320 EXPECT_TRUE(stats_proxy_->GetStats().cpu_limited_resolution);
1321 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
1322
1323 vie_encoder_->Stop();
1324 }
1325
1326 TEST_F(ViEEncoderTest, NoChangeForInitialNormalUsage_MaintainFramerateMode) {
1327 const int kWidth = 1280;
1328 const int kHeight = 720;
1329 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1330
1331 // Enable kMaintainFramerate preference, no initial limitation.
1332 test::FrameForwarder source;
1333 vie_encoder_->SetSource(
1334 &source, VideoSendStream::DegradationPreference::kMaintainFramerate);
1335
1336 source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
1337 sink_.WaitForEncodedFrame(kWidth, kHeight);
1338 VerifyNoLimitation(source.sink_wants());
1339 EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
1340 EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
1341
1342 // Trigger adapt up, expect no change.
1343 vie_encoder_->TriggerCpuNormalUsage();
1344 VerifyNoLimitation(source.sink_wants());
1345 EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
1346 EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
1347
1348 vie_encoder_->Stop();
1349 }
1350
1351 TEST_F(ViEEncoderTest, NoChangeForInitialNormalUsage_MaintainResolutionMode) {
1352 const int kWidth = 1280;
1353 const int kHeight = 720;
1354 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1355
1356 // Enable kMaintainResolution preference, no initial limitation.
1357 test::FrameForwarder source;
1358 vie_encoder_->SetSource(
1359 &source, VideoSendStream::DegradationPreference::kMaintainResolution);
1360
1361 source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
1362 sink_.WaitForEncodedFrame(kWidth, kHeight);
1363 VerifyNoLimitation(source.sink_wants());
1364 EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
1365 EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
1366
1367 // Trigger adapt up, expect no change.
1368 vie_encoder_->TriggerCpuNormalUsage();
1369 VerifyNoLimitation(source.sink_wants());
1370 EXPECT_FALSE(stats_proxy_->GetStats().cpu_limited_resolution);
1371 EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
1372
1373 vie_encoder_->Stop();
1374 }
1375
1376 TEST_F(ViEEncoderTest, AdaptsResolutionForLowQuality_MaintainFramerateMode) {
1377 const int kWidth = 1280;
1378 const int kHeight = 720;
1379 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1380
1381 // Enable kMaintainFramerate preference, no initial limitation.
1382 AdaptingFrameForwarder source;
1383 source.set_adaptation_enabled(true);
1384 vie_encoder_->SetSource(
1385 &source, VideoSendStream::DegradationPreference::kMaintainFramerate);
1386
1387 source.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
1388 sink_.WaitForEncodedFrame(1);
1389 VerifyNoLimitation(source.sink_wants());
1390 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
1391 EXPECT_EQ(0, stats_proxy_->GetStats().number_of_quality_adapt_changes);
1392
1393 // Trigger adapt down, expect scaled down resolution.
1394 vie_encoder_->TriggerQualityLow();
1395 source.IncomingCapturedFrame(CreateFrame(2, kWidth, kHeight));
1396 sink_.WaitForEncodedFrame(2);
1397 VerifyResolutionLimitationLessThan(source.sink_wants(), kWidth * kHeight);
1398 EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_resolution);
1399 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_quality_adapt_changes);
1400
1401 // Trigger adapt up, expect no restriction.
1402 vie_encoder_->TriggerQualityHigh();
1403 VerifyNoLimitation(source.sink_wants());
1404 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
1405 EXPECT_EQ(2, stats_proxy_->GetStats().number_of_quality_adapt_changes);
1406 EXPECT_EQ(0, stats_proxy_->GetStats().number_of_cpu_adapt_changes);
1407
1408 vie_encoder_->Stop();
1409 }
1410
1305 TEST_F(ViEEncoderTest, DoesNotScaleBelowSetLimit) { 1411 TEST_F(ViEEncoderTest, DoesNotScaleBelowSetLimit) {
1306 int frame_width = 1280; 1412 int frame_width = 1280;
1307 int frame_height = 720; 1413 int frame_height = 720;
1308 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 1414 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1309 1415
1310 for (size_t i = 1; i <= 10; i++) { 1416 for (size_t i = 1; i <= 10; i++) {
1311 video_source_.IncomingCapturedFrame( 1417 video_source_.IncomingCapturedFrame(
1312 CreateFrame(i, frame_width, frame_height)); 1418 CreateFrame(i, frame_width, frame_height));
1313 sink_.WaitForEncodedFrame(i); 1419 sink_.WaitForEncodedFrame(i);
1314 // Trigger scale down. 1420 // Trigger scale down.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 VideoSendStream::DegradationPreference::kBalanced); 1575 VideoSendStream::DegradationPreference::kBalanced);
1470 1576
1471 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight)); 1577 video_source_.IncomingCapturedFrame(CreateFrame(1, kWidth, kHeight));
1472 // Frame should not be dropped, even if it's too large. 1578 // Frame should not be dropped, even if it's too large.
1473 sink_.WaitForEncodedFrame(1); 1579 sink_.WaitForEncodedFrame(1);
1474 1580
1475 vie_encoder_->Stop(); 1581 vie_encoder_->Stop();
1476 fake_encoder_.SetQualityScaling(true); 1582 fake_encoder_.SetQualityScaling(true);
1477 } 1583 }
1478 1584
1585 TEST_F(ViEEncoderTest, FailingInitEncodeDoesntCauseCrash) {
1586 fake_encoder_.ForceInitEncodeFailure(true);
1587 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1588 ResetEncoder("VP8", 2, 1, true);
1589 const int kFrameWidth = 1280;
1590 const int kFrameHeight = 720;
1591 video_source_.IncomingCapturedFrame(
1592 CreateFrame(1, kFrameWidth, kFrameHeight));
1593 sink_.ExpectDroppedFrame();
1594 vie_encoder_->Stop();
1595 }
1596
1479 // TODO(sprang): Extend this with fps throttling and any "balanced" extensions. 1597 // TODO(sprang): Extend this with fps throttling and any "balanced" extensions.
1480 TEST_F(ViEEncoderTest, AdaptsResolutionOnOveruse) { 1598 TEST_F(ViEEncoderTest, AdaptsResolutionOnOveruse) {
1481 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 1599 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1482 1600
1483 const int kFrameWidth = 1280; 1601 const int kFrameWidth = 1280;
1484 const int kFrameHeight = 720; 1602 const int kFrameHeight = 720;
1485 // Enabled default VideoAdapter downscaling. First step is 3/4, not 3/5 as 1603 // Enabled default VideoAdapter downscaling. First step is 3/4, not 3/5 as
1486 // requested by ViEEncoder::VideoSourceProxy::RequestResolutionLowerThan(). 1604 // requested by ViEEncoder::VideoSourceProxy::RequestResolutionLowerThan().
1487 video_source_.set_adaptation_enabled(true); 1605 video_source_.set_adaptation_enabled(true);
1488 1606
1489 video_source_.IncomingCapturedFrame( 1607 video_source_.IncomingCapturedFrame(
1490 CreateFrame(1, kFrameWidth, kFrameHeight)); 1608 CreateFrame(1, kFrameWidth, kFrameHeight));
1491 sink_.WaitForEncodedFrame(kFrameWidth, kFrameHeight); 1609 sink_.WaitForEncodedFrame(kFrameWidth, kFrameHeight);
1492 1610
1493 // Trigger CPU overuse, downscale by 3/4. 1611 // Trigger CPU overuse, downscale by 3/4.
1494 vie_encoder_->TriggerCpuOveruse(); 1612 vie_encoder_->TriggerCpuOveruse();
1495 video_source_.IncomingCapturedFrame( 1613 video_source_.IncomingCapturedFrame(
1496 CreateFrame(2, kFrameWidth, kFrameHeight)); 1614 CreateFrame(2, kFrameWidth, kFrameHeight));
1497 sink_.WaitForEncodedFrame((kFrameWidth * 3) / 4, (kFrameHeight * 3) / 4); 1615 sink_.WaitForEncodedFrame((kFrameWidth * 3) / 4, (kFrameHeight * 3) / 4);
1498 1616
1499 // Trigger CPU normal use, return to original resolution. 1617 // Trigger CPU normal use, return to original resolution.
1500 vie_encoder_->TriggerCpuNormalUsage(); 1618 vie_encoder_->TriggerCpuNormalUsage();
1501 video_source_.IncomingCapturedFrame( 1619 video_source_.IncomingCapturedFrame(
1502 CreateFrame(3, kFrameWidth, kFrameHeight)); 1620 CreateFrame(3, kFrameWidth, kFrameHeight));
1503 sink_.WaitForEncodedFrame(kFrameWidth, kFrameHeight); 1621 sink_.WaitForEncodedFrame(kFrameWidth, kFrameHeight);
1504 1622
1505 vie_encoder_->Stop(); 1623 vie_encoder_->Stop();
1506 } 1624 }
1507 1625
1508 TEST_F(ViEEncoderTest, FailingInitEncodeDoesntCauseCrash) { 1626 TEST_F(ViEEncoderTest, AdaptsFramerateOnOveruse_MaintainResolutionMode) {
1509 fake_encoder_.ForceInitEncodeFailure(true);
1510 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1511 ResetEncoder("VP8", 2, 1, true);
1512 const int kFrameWidth = 1280;
1513 const int kFrameHeight = 720;
1514 video_source_.IncomingCapturedFrame(
1515 CreateFrame(1, kFrameWidth, kFrameHeight));
1516 sink_.ExpectDroppedFrame();
1517 vie_encoder_->Stop();
1518 }
1519
1520 TEST_F(ViEEncoderTest, AdaptsFrameOnOveruseWithMaintainResolution) {
1521 const int kDefaultFramerateFps = 30; 1627 const int kDefaultFramerateFps = 30;
1522 const int kFrameIntervalMs = rtc::kNumMillisecsPerSec / kDefaultFramerateFps; 1628 const int kFrameIntervalMs = rtc::kNumMillisecsPerSec / kDefaultFramerateFps;
1523 const int kFrameWidth = 1280; 1629 const int kFrameWidth = 1280;
1524 const int kFrameHeight = 720; 1630 const int kFrameHeight = 720;
1525 rtc::ScopedFakeClock fake_clock; 1631 rtc::ScopedFakeClock fake_clock;
1526 1632
1527 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 1633 vie_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
1528 vie_encoder_->SetSource( 1634 vie_encoder_->SetSource(
1529 &video_source_, 1635 &video_source_,
1530 VideoSendStream::DegradationPreference::kMaintainResolution); 1636 VideoSendStream::DegradationPreference::kMaintainResolution);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 for (int i = 0; i < 10; ++i) { 1770 for (int i = 0; i < 10; ++i) {
1665 timestamp_ms += kMinFpsFrameInterval; 1771 timestamp_ms += kMinFpsFrameInterval;
1666 fake_clock.AdvanceTimeMicros(kMinFpsFrameInterval * 1000); 1772 fake_clock.AdvanceTimeMicros(kMinFpsFrameInterval * 1000);
1667 video_source_.IncomingCapturedFrame( 1773 video_source_.IncomingCapturedFrame(
1668 CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight)); 1774 CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight));
1669 sink_.WaitForEncodedFrame(timestamp_ms); 1775 sink_.WaitForEncodedFrame(timestamp_ms);
1670 } 1776 }
1671 vie_encoder_->Stop(); 1777 vie_encoder_->Stop();
1672 } 1778 }
1673 } // namespace webrtc 1779 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/vie_encoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698