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

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

Issue 2925253002: Turn off error resilience for VP9 if no spatial or temporal layers are configured and NACK is enabl… (Closed)
Patch Set: rebase Created 3 years, 4 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/modules/video_coding/video_codec_initializer.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 16 matching lines...) Expand all
27 #include "webrtc/test/gtest.h" 27 #include "webrtc/test/gtest.h"
28 #include "webrtc/video/send_statistics_proxy.h" 28 #include "webrtc/video/send_statistics_proxy.h"
29 #include "webrtc/video/video_stream_encoder.h" 29 #include "webrtc/video/video_stream_encoder.h"
30 30
31 namespace { 31 namespace {
32 // TODO(kthelgason): Lower this limit when better testing 32 // TODO(kthelgason): Lower this limit when better testing
33 // on MediaCodec and fallback implementations are in place. 33 // on MediaCodec and fallback implementations are in place.
34 const int kMinPixelsPerFrame = 320 * 180; 34 const int kMinPixelsPerFrame = 320 * 180;
35 const int kMinFramerateFps = 2; 35 const int kMinFramerateFps = 2;
36 const int64_t kFrameTimeoutMs = 100; 36 const int64_t kFrameTimeoutMs = 100;
37 const unsigned char kNumSlDummy = 0;
37 } // namespace 38 } // namespace
38 39
39 namespace webrtc { 40 namespace webrtc {
40 41
41 using DegredationPreference = VideoSendStream::DegradationPreference; 42 using DegredationPreference = VideoSendStream::DegradationPreference;
42 using ScaleReason = AdaptationObserverInterface::AdaptReason; 43 using ScaleReason = AdaptationObserverInterface::AdaptReason;
43 using ::testing::_; 44 using ::testing::_;
44 using ::testing::Return; 45 using ::testing::Return;
45 46
46 namespace { 47 namespace {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 VideoSendStream::DegradationPreference::kMaintainFramerate); 311 VideoSendStream::DegradationPreference::kMaintainFramerate);
311 video_stream_encoder_->SetStartBitrate(kTargetBitrateBps); 312 video_stream_encoder_->SetStartBitrate(kTargetBitrateBps);
312 video_stream_encoder_->ConfigureEncoder(std::move(video_encoder_config), 313 video_stream_encoder_->ConfigureEncoder(std::move(video_encoder_config),
313 kMaxPayloadLength, nack_enabled); 314 kMaxPayloadLength, nack_enabled);
314 video_stream_encoder_->WaitUntilTaskQueueIsIdle(); 315 video_stream_encoder_->WaitUntilTaskQueueIsIdle();
315 } 316 }
316 317
317 void ResetEncoder(const std::string& payload_name, 318 void ResetEncoder(const std::string& payload_name,
318 size_t num_streams, 319 size_t num_streams,
319 size_t num_temporal_layers, 320 size_t num_temporal_layers,
321 unsigned char num_spatial_layers,
320 bool nack_enabled, 322 bool nack_enabled,
321 bool screenshare) { 323 bool screenshare) {
322 video_send_config_.encoder_settings.payload_name = payload_name; 324 video_send_config_.encoder_settings.payload_name = payload_name;
323 325
324 VideoEncoderConfig video_encoder_config; 326 VideoEncoderConfig video_encoder_config;
325 video_encoder_config.number_of_streams = num_streams; 327 video_encoder_config.number_of_streams = num_streams;
326 video_encoder_config.max_bitrate_bps = kTargetBitrateBps; 328 video_encoder_config.max_bitrate_bps = kTargetBitrateBps;
327 video_encoder_config.video_stream_factory = 329 video_encoder_config.video_stream_factory =
328 new rtc::RefCountedObject<VideoStreamFactory>(num_temporal_layers, 330 new rtc::RefCountedObject<VideoStreamFactory>(num_temporal_layers,
329 kDefaultFramerate); 331 kDefaultFramerate);
330 video_encoder_config.content_type = 332 video_encoder_config.content_type =
331 screenshare ? VideoEncoderConfig::ContentType::kScreen 333 screenshare ? VideoEncoderConfig::ContentType::kScreen
332 : VideoEncoderConfig::ContentType::kRealtimeVideo; 334 : VideoEncoderConfig::ContentType::kRealtimeVideo;
335 if (payload_name == "VP9") {
336 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings();
337 vp9_settings.numberOfSpatialLayers = num_spatial_layers;
338 video_encoder_config.encoder_specific_settings =
339 new rtc::RefCountedObject<
340 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings);
341 }
333 ConfigureEncoder(std::move(video_encoder_config), nack_enabled); 342 ConfigureEncoder(std::move(video_encoder_config), nack_enabled);
334 } 343 }
335 344
336 VideoFrame CreateFrame(int64_t ntp_time_ms, 345 VideoFrame CreateFrame(int64_t ntp_time_ms,
337 rtc::Event* destruction_event) const { 346 rtc::Event* destruction_event) const {
338 VideoFrame frame(new rtc::RefCountedObject<TestBuffer>( 347 VideoFrame frame(new rtc::RefCountedObject<TestBuffer>(
339 destruction_event, codec_width_, codec_height_), 348 destruction_event, codec_width_, codec_height_),
340 99, 99, kVideoRotation_0); 349 99, 99, kVideoRotation_0);
341 frame.set_ntp_time_ms(ntp_time_ms); 350 frame.set_ntp_time_ms(ntp_time_ms);
342 return frame; 351 return frame;
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 EXPECT_EQ(codec_height_, fake_encoder_.codec_config().height); 801 EXPECT_EQ(codec_height_, fake_encoder_.codec_config().height);
793 EXPECT_EQ(2, sink_.number_of_reconfigurations()); 802 EXPECT_EQ(2, sink_.number_of_reconfigurations());
794 803
795 video_stream_encoder_->Stop(); 804 video_stream_encoder_->Stop();
796 } 805 }
797 806
798 TEST_F(VideoStreamEncoderTest, Vp8ResilienceIsOffFor1S1TLWithNackEnabled) { 807 TEST_F(VideoStreamEncoderTest, Vp8ResilienceIsOffFor1S1TLWithNackEnabled) {
799 const bool kNackEnabled = true; 808 const bool kNackEnabled = true;
800 const size_t kNumStreams = 1; 809 const size_t kNumStreams = 1;
801 const size_t kNumTl = 1; 810 const size_t kNumTl = 1;
802 ResetEncoder("VP8", kNumStreams, kNumTl, kNackEnabled, false); 811 ResetEncoder("VP8", kNumStreams, kNumTl, kNumSlDummy, kNackEnabled, false);
803 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 812 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
804 813
805 // Capture a frame and wait for it to synchronize with the encoder thread. 814 // Capture a frame and wait for it to synchronize with the encoder thread.
806 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr)); 815 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
807 WaitForEncodedFrame(1); 816 WaitForEncodedFrame(1);
808 // The encoder have been configured once when the first frame is received. 817 // The encoder have been configured once when the first frame is received.
809 EXPECT_EQ(1, sink_.number_of_reconfigurations()); 818 EXPECT_EQ(1, sink_.number_of_reconfigurations());
810 EXPECT_EQ(kVideoCodecVP8, fake_encoder_.codec_config().codecType); 819 EXPECT_EQ(kVideoCodecVP8, fake_encoder_.codec_config().codecType);
811 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams); 820 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams);
812 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP8()->numberOfTemporalLayers); 821 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP8()->numberOfTemporalLayers);
813 // Resilience is off for no temporal layers with nack on. 822 // Resilience is off for no temporal layers with nack on.
814 EXPECT_EQ(kResilienceOff, fake_encoder_.codec_config().VP8()->resilience); 823 EXPECT_EQ(kResilienceOff, fake_encoder_.codec_config().VP8()->resilience);
815 video_stream_encoder_->Stop(); 824 video_stream_encoder_->Stop();
816 } 825 }
817 826
818 TEST_F(VideoStreamEncoderTest, Vp8ResilienceIsOffFor2S1TlWithNackEnabled) { 827 TEST_F(VideoStreamEncoderTest, Vp8ResilienceIsOffFor2S1TlWithNackEnabled) {
819 const bool kNackEnabled = true; 828 const bool kNackEnabled = true;
820 const size_t kNumStreams = 2; 829 const size_t kNumStreams = 2;
821 const size_t kNumTl = 1; 830 const size_t kNumTl = 1;
822 ResetEncoder("VP8", kNumStreams, kNumTl, kNackEnabled, false); 831 ResetEncoder("VP8", kNumStreams, kNumTl, kNumSlDummy, kNackEnabled, false);
823 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 832 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
824 833
825 // Capture a frame and wait for it to synchronize with the encoder thread. 834 // Capture a frame and wait for it to synchronize with the encoder thread.
826 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr)); 835 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
827 WaitForEncodedFrame(1); 836 WaitForEncodedFrame(1);
828 // The encoder have been configured once when the first frame is received. 837 // The encoder have been configured once when the first frame is received.
829 EXPECT_EQ(1, sink_.number_of_reconfigurations()); 838 EXPECT_EQ(1, sink_.number_of_reconfigurations());
830 EXPECT_EQ(kVideoCodecVP8, fake_encoder_.codec_config().codecType); 839 EXPECT_EQ(kVideoCodecVP8, fake_encoder_.codec_config().codecType);
831 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams); 840 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams);
832 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP8()->numberOfTemporalLayers); 841 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP8()->numberOfTemporalLayers);
833 // Resilience is off for no temporal layers and >1 streams with nack on. 842 // Resilience is off for no temporal layers and >1 streams with nack on.
834 EXPECT_EQ(kResilienceOff, fake_encoder_.codec_config().VP8()->resilience); 843 EXPECT_EQ(kResilienceOff, fake_encoder_.codec_config().VP8()->resilience);
835 video_stream_encoder_->Stop(); 844 video_stream_encoder_->Stop();
836 } 845 }
837 846
838 TEST_F(VideoStreamEncoderTest, Vp8ResilienceIsOnFor1S1TLWithNackDisabled) { 847 TEST_F(VideoStreamEncoderTest, Vp8ResilienceIsOnFor1S1TLWithNackDisabled) {
839 const bool kNackEnabled = false; 848 const bool kNackEnabled = false;
840 const size_t kNumStreams = 1; 849 const size_t kNumStreams = 1;
841 const size_t kNumTl = 1; 850 const size_t kNumTl = 1;
842 ResetEncoder("VP8", kNumStreams, kNumTl, kNackEnabled, false); 851 ResetEncoder("VP8", kNumStreams, kNumTl, kNumSlDummy, kNackEnabled, false);
843 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 852 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
844 853
845 // Capture a frame and wait for it to synchronize with the encoder thread. 854 // Capture a frame and wait for it to synchronize with the encoder thread.
846 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr)); 855 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
847 WaitForEncodedFrame(1); 856 WaitForEncodedFrame(1);
848 // The encoder have been configured once when the first frame is received. 857 // The encoder have been configured once when the first frame is received.
849 EXPECT_EQ(1, sink_.number_of_reconfigurations()); 858 EXPECT_EQ(1, sink_.number_of_reconfigurations());
850 EXPECT_EQ(kVideoCodecVP8, fake_encoder_.codec_config().codecType); 859 EXPECT_EQ(kVideoCodecVP8, fake_encoder_.codec_config().codecType);
851 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams); 860 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams);
852 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP8()->numberOfTemporalLayers); 861 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP8()->numberOfTemporalLayers);
853 // Resilience is on for no temporal layers with nack off. 862 // Resilience is on for no temporal layers with nack off.
854 EXPECT_EQ(kResilientStream, fake_encoder_.codec_config().VP8()->resilience); 863 EXPECT_EQ(kResilientStream, fake_encoder_.codec_config().VP8()->resilience);
855 video_stream_encoder_->Stop(); 864 video_stream_encoder_->Stop();
856 } 865 }
857 866
858 TEST_F(VideoStreamEncoderTest, Vp8ResilienceIsOnFor1S2TlWithNackEnabled) { 867 TEST_F(VideoStreamEncoderTest, Vp8ResilienceIsOnFor1S2TlWithNackEnabled) {
859 const bool kNackEnabled = true; 868 const bool kNackEnabled = true;
860 const size_t kNumStreams = 1; 869 const size_t kNumStreams = 1;
861 const size_t kNumTl = 2; 870 const size_t kNumTl = 2;
862 ResetEncoder("VP8", kNumStreams, kNumTl, kNackEnabled, false); 871 ResetEncoder("VP8", kNumStreams, kNumTl, kNumSlDummy, kNackEnabled, false);
863 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 872 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
864 873
865 // Capture a frame and wait for it to synchronize with the encoder thread. 874 // Capture a frame and wait for it to synchronize with the encoder thread.
866 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr)); 875 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
867 WaitForEncodedFrame(1); 876 WaitForEncodedFrame(1);
868 // The encoder have been configured once when the first frame is received. 877 // The encoder have been configured once when the first frame is received.
869 EXPECT_EQ(1, sink_.number_of_reconfigurations()); 878 EXPECT_EQ(1, sink_.number_of_reconfigurations());
870 EXPECT_EQ(kVideoCodecVP8, fake_encoder_.codec_config().codecType); 879 EXPECT_EQ(kVideoCodecVP8, fake_encoder_.codec_config().codecType);
871 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams); 880 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams);
872 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP8()->numberOfTemporalLayers); 881 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP8()->numberOfTemporalLayers);
873 // Resilience is on for temporal layers. 882 // Resilience is on for temporal layers.
874 EXPECT_EQ(kResilientStream, fake_encoder_.codec_config().VP8()->resilience); 883 EXPECT_EQ(kResilientStream, fake_encoder_.codec_config().VP8()->resilience);
875 video_stream_encoder_->Stop(); 884 video_stream_encoder_->Stop();
876 } 885 }
877 886
887 TEST_F(VideoStreamEncoderTest, Vp9ResilienceIsOffFor1SL1TLWithNackEnabled) {
888 const bool kNackEnabled = true;
889 const size_t kNumStreams = 1;
890 const size_t kNumTl = 1;
891 const unsigned char kNumSl = 1;
892 ResetEncoder("VP9", kNumStreams, kNumTl, kNumSl, kNackEnabled, false);
893 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
894
895 // Capture a frame and wait for it to synchronize with the encoder thread.
896 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
897 sink_.WaitForEncodedFrame(1);
898 // The encoder have been configured once when the first frame is received.
899 EXPECT_EQ(1, sink_.number_of_reconfigurations());
900 EXPECT_EQ(kVideoCodecVP9, fake_encoder_.codec_config().codecType);
901 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams);
902 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP9()->numberOfTemporalLayers);
903 EXPECT_EQ(kNumSl, fake_encoder_.codec_config().VP9()->numberOfSpatialLayers);
904 // Resilience is off for no spatial and temporal layers with nack on.
905 EXPECT_FALSE(fake_encoder_.codec_config().VP9()->resilienceOn);
906 video_stream_encoder_->Stop();
907 }
908
909 TEST_F(VideoStreamEncoderTest, Vp9ResilienceIsOnFor1SL1TLWithNackDisabled) {
910 const bool kNackEnabled = false;
911 const size_t kNumStreams = 1;
912 const size_t kNumTl = 1;
913 const unsigned char kNumSl = 1;
914 ResetEncoder("VP9", kNumStreams, kNumTl, kNumSl, kNackEnabled, false);
915 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
916
917 // Capture a frame and wait for it to synchronize with the encoder thread.
918 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
919 sink_.WaitForEncodedFrame(1);
920 // The encoder have been configured once when the first frame is received.
921 EXPECT_EQ(1, sink_.number_of_reconfigurations());
922 EXPECT_EQ(kVideoCodecVP9, fake_encoder_.codec_config().codecType);
923 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams);
924 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP9()->numberOfTemporalLayers);
925 EXPECT_EQ(kNumSl, fake_encoder_.codec_config().VP9()->numberOfSpatialLayers);
926 // Resilience is on if nack is off.
927 EXPECT_TRUE(fake_encoder_.codec_config().VP9()->resilienceOn);
928 video_stream_encoder_->Stop();
929 }
930
931 TEST_F(VideoStreamEncoderTest, Vp9ResilienceIsOnFor2SL1TLWithNackEnabled) {
932 const bool kNackEnabled = true;
933 const size_t kNumStreams = 1;
934 const size_t kNumTl = 1;
935 const unsigned char kNumSl = 2;
936 ResetEncoder("VP9", kNumStreams, kNumTl, kNumSl, kNackEnabled, false);
937 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
938
939 // Capture a frame and wait for it to synchronize with the encoder thread.
940 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
941 sink_.WaitForEncodedFrame(1);
942 // The encoder have been configured once when the first frame is received.
943 EXPECT_EQ(1, sink_.number_of_reconfigurations());
944 EXPECT_EQ(kVideoCodecVP9, fake_encoder_.codec_config().codecType);
945 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams);
946 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP9()->numberOfTemporalLayers);
947 EXPECT_EQ(kNumSl, fake_encoder_.codec_config().VP9()->numberOfSpatialLayers);
948 // Resilience is on for spatial layers.
949 EXPECT_TRUE(fake_encoder_.codec_config().VP9()->resilienceOn);
950 video_stream_encoder_->Stop();
951 }
952
953 TEST_F(VideoStreamEncoderTest, Vp9ResilienceIsOnFor1SL2TLWithNackEnabled) {
954 const bool kNackEnabled = true;
955 const size_t kNumStreams = 1;
956 const size_t kNumTl = 2;
957 const unsigned char kNumSl = 1;
958 ResetEncoder("VP9", kNumStreams, kNumTl, kNumSl, kNackEnabled, false);
959 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
960
961 // Capture a frame and wait for it to synchronize with the encoder thread.
962 video_source_.IncomingCapturedFrame(CreateFrame(1, nullptr));
963 sink_.WaitForEncodedFrame(1);
964 // The encoder have been configured once when the first frame is received.
965 EXPECT_EQ(1, sink_.number_of_reconfigurations());
966 EXPECT_EQ(kVideoCodecVP9, fake_encoder_.codec_config().codecType);
967 EXPECT_EQ(kNumStreams, fake_encoder_.codec_config().numberOfSimulcastStreams);
968 EXPECT_EQ(kNumTl, fake_encoder_.codec_config().VP9()->numberOfTemporalLayers);
969 EXPECT_EQ(kNumSl, fake_encoder_.codec_config().VP9()->numberOfSpatialLayers);
970 // Resilience is on for temporal layers.
971 EXPECT_TRUE(fake_encoder_.codec_config().VP9()->resilienceOn);
972 video_stream_encoder_->Stop();
973 }
974
878 TEST_F(VideoStreamEncoderTest, SwitchSourceDeregisterEncoderAsSink) { 975 TEST_F(VideoStreamEncoderTest, SwitchSourceDeregisterEncoderAsSink) {
879 EXPECT_TRUE(video_source_.has_sinks()); 976 EXPECT_TRUE(video_source_.has_sinks());
880 test::FrameForwarder new_video_source; 977 test::FrameForwarder new_video_source;
881 video_stream_encoder_->SetSource( 978 video_stream_encoder_->SetSource(
882 &new_video_source, 979 &new_video_source,
883 VideoSendStream::DegradationPreference::kMaintainFramerate); 980 VideoSendStream::DegradationPreference::kMaintainFramerate);
884 EXPECT_FALSE(video_source_.has_sinks()); 981 EXPECT_FALSE(video_source_.has_sinks());
885 EXPECT_TRUE(new_video_source.has_sinks()); 982 EXPECT_TRUE(new_video_source.has_sinks());
886 983
887 video_stream_encoder_->Stop(); 984 video_stream_encoder_->Stop();
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution); 2553 EXPECT_FALSE(stats_proxy_->GetStats().bw_limited_resolution);
2457 EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_framerate); 2554 EXPECT_TRUE(stats_proxy_->GetStats().bw_limited_framerate);
2458 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_quality_adapt_changes); 2555 EXPECT_EQ(1, stats_proxy_->GetStats().number_of_quality_adapt_changes);
2459 2556
2460 video_stream_encoder_->Stop(); 2557 video_stream_encoder_->Stop();
2461 } 2558 }
2462 2559
2463 TEST_F(VideoStreamEncoderTest, FailingInitEncodeDoesntCauseCrash) { 2560 TEST_F(VideoStreamEncoderTest, FailingInitEncodeDoesntCauseCrash) {
2464 fake_encoder_.ForceInitEncodeFailure(true); 2561 fake_encoder_.ForceInitEncodeFailure(true);
2465 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 2562 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
2466 ResetEncoder("VP8", 2, 1, true, false); 2563 ResetEncoder("VP8", 2, 1, 1, true, false);
2467 const int kFrameWidth = 1280; 2564 const int kFrameWidth = 1280;
2468 const int kFrameHeight = 720; 2565 const int kFrameHeight = 720;
2469 video_source_.IncomingCapturedFrame( 2566 video_source_.IncomingCapturedFrame(
2470 CreateFrame(1, kFrameWidth, kFrameHeight)); 2567 CreateFrame(1, kFrameWidth, kFrameHeight));
2471 ExpectDroppedFrame(); 2568 ExpectDroppedFrame();
2472 video_stream_encoder_->Stop(); 2569 video_stream_encoder_->Stop();
2473 } 2570 }
2474 2571
2475 // TODO(sprang): Extend this with fps throttling and any "balanced" extensions. 2572 // TODO(sprang): Extend this with fps throttling and any "balanced" extensions.
2476 TEST_F(VideoStreamEncoderTest, 2573 TEST_F(VideoStreamEncoderTest,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2603 2700
2604 TEST_F(VideoStreamEncoderTest, DoesntAdaptDownPastMinFramerate) { 2701 TEST_F(VideoStreamEncoderTest, DoesntAdaptDownPastMinFramerate) {
2605 const int kFramerateFps = 5; 2702 const int kFramerateFps = 5;
2606 const int kFrameIntervalMs = rtc::kNumMillisecsPerSec / kFramerateFps; 2703 const int kFrameIntervalMs = rtc::kNumMillisecsPerSec / kFramerateFps;
2607 const int kMinFpsFrameInterval = rtc::kNumMillisecsPerSec / kMinFramerateFps; 2704 const int kMinFpsFrameInterval = rtc::kNumMillisecsPerSec / kMinFramerateFps;
2608 const int kFrameWidth = 1280; 2705 const int kFrameWidth = 1280;
2609 const int kFrameHeight = 720; 2706 const int kFrameHeight = 720;
2610 2707
2611 // Reconfigure encoder with two temporal layers and screensharing, which will 2708 // Reconfigure encoder with two temporal layers and screensharing, which will
2612 // disable frame dropping and make testing easier. 2709 // disable frame dropping and make testing easier.
2613 ResetEncoder("VP8", 1, 2, true, true); 2710 ResetEncoder("VP8", 1, 2, 1, true, true);
2614 2711
2615 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0); 2712 video_stream_encoder_->OnBitrateUpdated(kTargetBitrateBps, 0, 0);
2616 video_stream_encoder_->SetSource( 2713 video_stream_encoder_->SetSource(
2617 &video_source_, 2714 &video_source_,
2618 VideoSendStream::DegradationPreference::kMaintainResolution); 2715 VideoSendStream::DegradationPreference::kMaintainResolution);
2619 video_source_.set_adaptation_enabled(true); 2716 video_source_.set_adaptation_enabled(true);
2620 2717
2621 int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec; 2718 int64_t timestamp_ms = fake_clock_.TimeNanos() / rtc::kNumNanosecsPerMillisec;
2622 2719
2623 // Trigger overuse as much as we can. 2720 // Trigger overuse as much as we can.
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
3176 // Bitrate observer should not be called. 3273 // Bitrate observer should not be called.
3177 EXPECT_CALL(bitrate_observer, OnBitrateAllocationUpdated(_)).Times(0); 3274 EXPECT_CALL(bitrate_observer, OnBitrateAllocationUpdated(_)).Times(0);
3178 video_source_.IncomingCapturedFrame( 3275 video_source_.IncomingCapturedFrame(
3179 CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight)); 3276 CreateFrame(timestamp_ms, kFrameWidth, kFrameHeight));
3180 ExpectDroppedFrame(); 3277 ExpectDroppedFrame();
3181 3278
3182 video_stream_encoder_->Stop(); 3279 video_stream_encoder_->Stop();
3183 } 3280 }
3184 3281
3185 } // namespace webrtc 3282 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/video_codec_initializer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698