OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 it = rtx_types.find(config.encoder_settings.payload_type); | 95 it = rtx_types.find(config.encoder_settings.payload_type); |
96 EXPECT_TRUE(it != rtx_types.end() && | 96 EXPECT_TRUE(it != rtx_types.end() && |
97 it->second == config.rtp.rtx.payload_type); | 97 it->second == config.rtp.rtx.payload_type); |
98 | 98 |
99 if (config.rtp.ulpfec.red_rtx_payload_type != -1) { | 99 if (config.rtp.ulpfec.red_rtx_payload_type != -1) { |
100 it = rtx_types.find(config.rtp.ulpfec.red_payload_type); | 100 it = rtx_types.find(config.rtp.ulpfec.red_payload_type); |
101 EXPECT_TRUE(it != rtx_types.end() && | 101 EXPECT_TRUE(it != rtx_types.end() && |
102 it->second == config.rtp.ulpfec.red_rtx_payload_type); | 102 it->second == config.rtp.ulpfec.red_rtx_payload_type); |
103 } | 103 } |
104 } | 104 } |
| 105 |
| 106 cricket::MediaConfig GetMediaConfig() { |
| 107 cricket::MediaConfig media_config; |
| 108 media_config.video.enable_cpu_overuse_detection = false; |
| 109 return media_config; |
| 110 } |
105 } // namespace | 111 } // namespace |
106 | 112 |
107 namespace cricket { | 113 namespace cricket { |
108 class WebRtcVideoEngine2Test : public ::testing::Test { | 114 class WebRtcVideoEngine2Test : public ::testing::Test { |
109 public: | 115 public: |
110 WebRtcVideoEngine2Test() : WebRtcVideoEngine2Test("") {} | 116 WebRtcVideoEngine2Test() : WebRtcVideoEngine2Test("") {} |
111 explicit WebRtcVideoEngine2Test(const char* field_trials) | 117 explicit WebRtcVideoEngine2Test(const char* field_trials) |
112 : override_field_trials_(field_trials), | 118 : override_field_trials_(field_trials), |
113 call_(webrtc::Call::Create(webrtc::Call::Config(&event_log_))), | 119 call_(webrtc::Call::Create(webrtc::Call::Config(&event_log_))), |
114 engine_() { | 120 engine_() { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 329 |
324 // Verify removing header extension turns on applying rotation. | 330 // Verify removing header extension turns on applying rotation. |
325 parameters.extensions.clear(); | 331 parameters.extensions.clear(); |
326 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 332 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
327 EXPECT_TRUE(capturer.apply_rotation()); | 333 EXPECT_TRUE(capturer.apply_rotation()); |
328 } | 334 } |
329 | 335 |
330 TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) { | 336 TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) { |
331 engine_.Init(); | 337 engine_.Init(); |
332 std::unique_ptr<VideoMediaChannel> channel( | 338 std::unique_ptr<VideoMediaChannel> channel( |
333 engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions())); | 339 engine_.CreateChannel(call_.get(), GetMediaConfig(), VideoOptions())); |
334 | 340 |
335 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); | 341 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); |
336 | 342 |
337 EXPECT_FALSE(channel->SetSend(true)) | 343 EXPECT_FALSE(channel->SetSend(true)) |
338 << "Channel should not start without codecs."; | 344 << "Channel should not start without codecs."; |
339 EXPECT_TRUE(channel->SetSend(false)) | 345 EXPECT_TRUE(channel->SetSend(false)) |
340 << "Channel should be stoppable even without set codecs."; | 346 << "Channel should be stoppable even without set codecs."; |
341 } | 347 } |
342 | 348 |
343 TEST_F(WebRtcVideoEngine2Test, GetStatsWithoutSendCodecsSetDoesNotCrash) { | 349 TEST_F(WebRtcVideoEngine2Test, GetStatsWithoutSendCodecsSetDoesNotCrash) { |
344 engine_.Init(); | 350 engine_.Init(); |
345 std::unique_ptr<VideoMediaChannel> channel( | 351 std::unique_ptr<VideoMediaChannel> channel( |
346 engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions())); | 352 engine_.CreateChannel(call_.get(), GetMediaConfig(), VideoOptions())); |
347 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); | 353 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); |
348 VideoMediaInfo info; | 354 VideoMediaInfo info; |
349 channel->GetStats(&info); | 355 channel->GetStats(&info); |
350 } | 356 } |
351 | 357 |
352 TEST_F(WebRtcVideoEngine2Test, UseExternalFactoryForVp8WhenSupported) { | 358 TEST_F(WebRtcVideoEngine2Test, UseExternalFactoryForVp8WhenSupported) { |
353 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 359 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
354 encoder_factory.AddSupportedVideoCodecType("VP8"); | 360 encoder_factory.AddSupportedVideoCodecType("VP8"); |
355 | 361 |
356 std::unique_ptr<VideoMediaChannel> channel( | 362 std::unique_ptr<VideoMediaChannel> channel( |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 437 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
432 encoder_factory.AddSupportedVideoCodecType("VP8"); | 438 encoder_factory.AddSupportedVideoCodecType("VP8"); |
433 std::unique_ptr<VideoMediaChannel> channel; | 439 std::unique_ptr<VideoMediaChannel> channel; |
434 FakeCall* fake_call = new FakeCall(webrtc::Call::Config(&event_log_)); | 440 FakeCall* fake_call = new FakeCall(webrtc::Call::Config(&event_log_)); |
435 call_.reset(fake_call); | 441 call_.reset(fake_call); |
436 if (use_external_encoder) { | 442 if (use_external_encoder) { |
437 channel.reset(SetUpForExternalEncoderFactory(&encoder_factory)); | 443 channel.reset(SetUpForExternalEncoderFactory(&encoder_factory)); |
438 } else { | 444 } else { |
439 engine_.Init(); | 445 engine_.Init(); |
440 channel.reset( | 446 channel.reset( |
441 engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions())); | 447 engine_.CreateChannel(call_.get(), GetMediaConfig(), VideoOptions())); |
442 } | 448 } |
443 ASSERT_TRUE( | 449 ASSERT_TRUE( |
444 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); | 450 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
445 cricket::VideoSendParameters parameters; | 451 cricket::VideoSendParameters parameters; |
446 parameters.codecs.push_back(GetEngineCodec("VP8")); | 452 parameters.codecs.push_back(GetEngineCodec("VP8")); |
447 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 453 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
448 EXPECT_TRUE(channel->SetSend(true)); | 454 EXPECT_TRUE(channel->SetSend(true)); |
449 FakeVideoSendStream* stream = fake_call->GetVideoSendStreams()[0]; | 455 FakeVideoSendStream* stream = fake_call->GetVideoSendStreams()[0]; |
450 | 456 |
451 EXPECT_EQ(use_external_encoder, | 457 EXPECT_EQ(use_external_encoder, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 ADD_FAILURE() << "Unrecognized codec name: " << name; | 547 ADD_FAILURE() << "Unrecognized codec name: " << name; |
542 return cricket::VideoCodec(); | 548 return cricket::VideoCodec(); |
543 } | 549 } |
544 | 550 |
545 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( | 551 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( |
546 cricket::WebRtcVideoEncoderFactory* encoder_factory) { | 552 cricket::WebRtcVideoEncoderFactory* encoder_factory) { |
547 engine_.SetExternalEncoderFactory(encoder_factory); | 553 engine_.SetExternalEncoderFactory(encoder_factory); |
548 engine_.Init(); | 554 engine_.Init(); |
549 | 555 |
550 VideoMediaChannel* channel = | 556 VideoMediaChannel* channel = |
551 engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions()); | 557 engine_.CreateChannel(call_.get(), GetMediaConfig(), VideoOptions()); |
552 cricket::VideoSendParameters parameters; | 558 cricket::VideoSendParameters parameters; |
553 // We need to look up the codec in the engine to get the correct payload type. | 559 // We need to look up the codec in the engine to get the correct payload type. |
554 for (const VideoCodec& codec : encoder_factory->supported_codecs()) | 560 for (const VideoCodec& codec : encoder_factory->supported_codecs()) |
555 parameters.codecs.push_back(GetEngineCodec(codec.name)); | 561 parameters.codecs.push_back(GetEngineCodec(codec.name)); |
556 | 562 |
557 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 563 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
558 | 564 |
559 return channel; | 565 return channel; |
560 } | 566 } |
561 | 567 |
562 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalDecoderFactory( | 568 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalDecoderFactory( |
563 cricket::WebRtcVideoDecoderFactory* decoder_factory, | 569 cricket::WebRtcVideoDecoderFactory* decoder_factory, |
564 const std::vector<VideoCodec>& codecs) { | 570 const std::vector<VideoCodec>& codecs) { |
565 engine_.SetExternalDecoderFactory(decoder_factory); | 571 engine_.SetExternalDecoderFactory(decoder_factory); |
566 engine_.Init(); | 572 engine_.Init(); |
567 | 573 |
568 VideoMediaChannel* channel = | 574 VideoMediaChannel* channel = |
569 engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions()); | 575 engine_.CreateChannel(call_.get(), GetMediaConfig(), VideoOptions()); |
570 cricket::VideoRecvParameters parameters; | 576 cricket::VideoRecvParameters parameters; |
571 parameters.codecs = codecs; | 577 parameters.codecs = codecs; |
572 EXPECT_TRUE(channel->SetRecvParameters(parameters)); | 578 EXPECT_TRUE(channel->SetRecvParameters(parameters)); |
573 | 579 |
574 return channel; | 580 return channel; |
575 } | 581 } |
576 | 582 |
577 TEST_F(WebRtcVideoEngine2Test, UsesSimulcastAdapterForVp8Factories) { | 583 TEST_F(WebRtcVideoEngine2Test, UsesSimulcastAdapterForVp8Factories) { |
578 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 584 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
579 encoder_factory.AddSupportedVideoCodecType("VP8"); | 585 encoder_factory.AddSupportedVideoCodecType("VP8"); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 | 638 |
633 TEST_F(WebRtcVideoEngine2Test, | 639 TEST_F(WebRtcVideoEngine2Test, |
634 DontUseExternalEncoderFactoryForUnsupportedCodecs) { | 640 DontUseExternalEncoderFactoryForUnsupportedCodecs) { |
635 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 641 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
636 encoder_factory.AddSupportedVideoCodecType("H264"); | 642 encoder_factory.AddSupportedVideoCodecType("H264"); |
637 | 643 |
638 engine_.SetExternalEncoderFactory(&encoder_factory); | 644 engine_.SetExternalEncoderFactory(&encoder_factory); |
639 engine_.Init(); | 645 engine_.Init(); |
640 | 646 |
641 std::unique_ptr<VideoMediaChannel> channel( | 647 std::unique_ptr<VideoMediaChannel> channel( |
642 engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions())); | 648 engine_.CreateChannel(call_.get(), GetMediaConfig(), VideoOptions())); |
643 cricket::VideoSendParameters parameters; | 649 cricket::VideoSendParameters parameters; |
644 parameters.codecs.push_back(GetEngineCodec("VP8")); | 650 parameters.codecs.push_back(GetEngineCodec("VP8")); |
645 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 651 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
646 | 652 |
647 EXPECT_TRUE( | 653 EXPECT_TRUE( |
648 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); | 654 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
649 // Make sure DestroyVideoEncoder was called on the factory. | 655 // Make sure DestroyVideoEncoder was called on the factory. |
650 ASSERT_EQ(0u, encoder_factory.encoders().size()); | 656 ASSERT_EQ(0u, encoder_factory.encoders().size()); |
651 } | 657 } |
652 | 658 |
653 TEST_F(WebRtcVideoEngine2Test, | 659 TEST_F(WebRtcVideoEngine2Test, |
654 UsesSimulcastAdapterForVp8WithCombinedVP8AndH264Factory) { | 660 UsesSimulcastAdapterForVp8WithCombinedVP8AndH264Factory) { |
655 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 661 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
656 encoder_factory.AddSupportedVideoCodecType("VP8"); | 662 encoder_factory.AddSupportedVideoCodecType("VP8"); |
657 encoder_factory.AddSupportedVideoCodecType("H264"); | 663 encoder_factory.AddSupportedVideoCodecType("H264"); |
658 | 664 |
659 engine_.SetExternalEncoderFactory(&encoder_factory); | 665 engine_.SetExternalEncoderFactory(&encoder_factory); |
660 engine_.Init(); | 666 engine_.Init(); |
661 | 667 |
662 std::unique_ptr<VideoMediaChannel> channel( | 668 std::unique_ptr<VideoMediaChannel> channel( |
663 engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions())); | 669 engine_.CreateChannel(call_.get(), GetMediaConfig(), VideoOptions())); |
664 cricket::VideoSendParameters parameters; | 670 cricket::VideoSendParameters parameters; |
665 parameters.codecs.push_back(GetEngineCodec("VP8")); | 671 parameters.codecs.push_back(GetEngineCodec("VP8")); |
666 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 672 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
667 | 673 |
668 std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs3); | 674 std::vector<uint32_t> ssrcs = MAKE_VECTOR(kSsrcs3); |
669 | 675 |
670 EXPECT_TRUE( | 676 EXPECT_TRUE( |
671 channel->AddSendStream(CreateSimStreamParams("cname", ssrcs))); | 677 channel->AddSendStream(CreateSimStreamParams("cname", ssrcs))); |
672 EXPECT_TRUE(channel->SetSend(true)); | 678 EXPECT_TRUE(channel->SetSend(true)); |
673 | 679 |
(...skipping 19 matching lines...) Expand all Loading... |
693 TEST_F(WebRtcVideoEngine2Test, | 699 TEST_F(WebRtcVideoEngine2Test, |
694 DestroysNonSimulcastEncoderFromCombinedVP8AndH264Factory) { | 700 DestroysNonSimulcastEncoderFromCombinedVP8AndH264Factory) { |
695 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 701 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
696 encoder_factory.AddSupportedVideoCodecType("VP8"); | 702 encoder_factory.AddSupportedVideoCodecType("VP8"); |
697 encoder_factory.AddSupportedVideoCodecType("H264"); | 703 encoder_factory.AddSupportedVideoCodecType("H264"); |
698 | 704 |
699 engine_.SetExternalEncoderFactory(&encoder_factory); | 705 engine_.SetExternalEncoderFactory(&encoder_factory); |
700 engine_.Init(); | 706 engine_.Init(); |
701 | 707 |
702 std::unique_ptr<VideoMediaChannel> channel( | 708 std::unique_ptr<VideoMediaChannel> channel( |
703 engine_.CreateChannel(call_.get(), MediaConfig(), VideoOptions())); | 709 engine_.CreateChannel(call_.get(), GetMediaConfig(), VideoOptions())); |
704 cricket::VideoSendParameters parameters; | 710 cricket::VideoSendParameters parameters; |
705 parameters.codecs.push_back(GetEngineCodec("H264")); | 711 parameters.codecs.push_back(GetEngineCodec("H264")); |
706 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 712 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
707 | 713 |
708 EXPECT_TRUE( | 714 EXPECT_TRUE( |
709 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); | 715 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
710 ASSERT_EQ(1u, encoder_factory.encoders().size()); | 716 ASSERT_EQ(1u, encoder_factory.encoders().size()); |
711 | 717 |
712 // Send a frame of 720p. This should trigger a "real" encoder initialization. | 718 // Send a frame of 720p. This should trigger a "real" encoder initialization. |
713 cricket::VideoFormat format( | 719 cricket::VideoFormat format( |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 } | 962 } |
957 | 963 |
958 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { | 964 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { |
959 public: | 965 public: |
960 WebRtcVideoChannel2Test() : WebRtcVideoChannel2Test("") {} | 966 WebRtcVideoChannel2Test() : WebRtcVideoChannel2Test("") {} |
961 explicit WebRtcVideoChannel2Test(const char* field_trials) | 967 explicit WebRtcVideoChannel2Test(const char* field_trials) |
962 : WebRtcVideoEngine2Test(field_trials), last_ssrc_(0) {} | 968 : WebRtcVideoEngine2Test(field_trials), last_ssrc_(0) {} |
963 void SetUp() override { | 969 void SetUp() override { |
964 fake_call_.reset(new FakeCall(webrtc::Call::Config(&event_log_))); | 970 fake_call_.reset(new FakeCall(webrtc::Call::Config(&event_log_))); |
965 engine_.Init(); | 971 engine_.Init(); |
966 channel_.reset( | 972 channel_.reset(engine_.CreateChannel(fake_call_.get(), GetMediaConfig(), |
967 engine_.CreateChannel(fake_call_.get(), MediaConfig(), VideoOptions())); | 973 VideoOptions())); |
968 channel_->OnReadyToSend(true); | 974 channel_->OnReadyToSend(true); |
969 last_ssrc_ = 123; | 975 last_ssrc_ = 123; |
970 send_parameters_.codecs = engine_.codecs(); | 976 send_parameters_.codecs = engine_.codecs(); |
971 recv_parameters_.codecs = engine_.codecs(); | 977 recv_parameters_.codecs = engine_.codecs(); |
972 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); | 978 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); |
973 } | 979 } |
974 | 980 |
975 protected: | 981 protected: |
976 FakeVideoSendStream* AddSendStream() { | 982 FakeVideoSendStream* AddSendStream() { |
977 return AddSendStream(StreamParams::CreateLegacy(++last_ssrc_)); | 983 return AddSendStream(StreamParams::CreateLegacy(++last_ssrc_)); |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 | 1772 |
1767 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); | 1773 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
1768 } | 1774 } |
1769 | 1775 |
1770 TEST_F(WebRtcVideoChannel2Test, SuspendBelowMinBitrateDisabledByDefault) { | 1776 TEST_F(WebRtcVideoChannel2Test, SuspendBelowMinBitrateDisabledByDefault) { |
1771 FakeVideoSendStream* stream = AddSendStream(); | 1777 FakeVideoSendStream* stream = AddSendStream(); |
1772 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); | 1778 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); |
1773 } | 1779 } |
1774 | 1780 |
1775 TEST_F(WebRtcVideoChannel2Test, SetMediaConfigSuspendBelowMinBitrate) { | 1781 TEST_F(WebRtcVideoChannel2Test, SetMediaConfigSuspendBelowMinBitrate) { |
1776 MediaConfig media_config = MediaConfig(); | 1782 MediaConfig media_config = GetMediaConfig(); |
1777 media_config.video.suspend_below_min_bitrate = true; | 1783 media_config.video.suspend_below_min_bitrate = true; |
1778 | 1784 |
1779 channel_.reset( | 1785 channel_.reset( |
1780 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); | 1786 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); |
1781 channel_->OnReadyToSend(true); | 1787 channel_->OnReadyToSend(true); |
1782 | 1788 |
1783 channel_->SetSendParameters(send_parameters_); | 1789 channel_->SetSendParameters(send_parameters_); |
1784 | 1790 |
1785 FakeVideoSendStream* stream = AddSendStream(); | 1791 FakeVideoSendStream* stream = AddSendStream(); |
1786 EXPECT_TRUE(stream->GetConfig().suspend_below_min_bitrate); | 1792 EXPECT_TRUE(stream->GetConfig().suspend_below_min_bitrate); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2063 | 2069 |
2064 TEST_F(WebRtcVideoChannel2Test, DoesNotAdaptOnOveruseWhenScreensharing) { | 2070 TEST_F(WebRtcVideoChannel2Test, DoesNotAdaptOnOveruseWhenScreensharing) { |
2065 TestCpuAdaptation(true, true); | 2071 TestCpuAdaptation(true, true); |
2066 } | 2072 } |
2067 | 2073 |
2068 TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) { | 2074 TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) { |
2069 cricket::VideoCodec codec = GetEngineCodec("VP8"); | 2075 cricket::VideoCodec codec = GetEngineCodec("VP8"); |
2070 cricket::VideoSendParameters parameters; | 2076 cricket::VideoSendParameters parameters; |
2071 parameters.codecs.push_back(codec); | 2077 parameters.codecs.push_back(codec); |
2072 | 2078 |
2073 MediaConfig media_config = MediaConfig(); | 2079 MediaConfig media_config = GetMediaConfig(); |
2074 channel_.reset( | 2080 channel_.reset( |
2075 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); | 2081 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); |
2076 channel_->OnReadyToSend(true); | 2082 channel_->OnReadyToSend(true); |
2077 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2083 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
2078 | 2084 |
2079 AddSendStream(); | 2085 AddSendStream(); |
2080 | 2086 |
2081 cricket::FakeVideoCapturer capturer; | 2087 cricket::FakeVideoCapturer capturer; |
2082 ASSERT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); | 2088 ASSERT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
2083 ASSERT_EQ(cricket::CS_RUNNING, | 2089 ASSERT_EQ(cricket::CS_RUNNING, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2138 EXPECT_EQ(724, send_stream->GetLastHeight()); | 2144 EXPECT_EQ(724, send_stream->GetLastHeight()); |
2139 | 2145 |
2140 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); | 2146 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
2141 } | 2147 } |
2142 | 2148 |
2143 TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) { | 2149 TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) { |
2144 cricket::VideoCodec codec = GetEngineCodec("VP8"); | 2150 cricket::VideoCodec codec = GetEngineCodec("VP8"); |
2145 cricket::VideoSendParameters parameters; | 2151 cricket::VideoSendParameters parameters; |
2146 parameters.codecs.push_back(codec); | 2152 parameters.codecs.push_back(codec); |
2147 | 2153 |
2148 MediaConfig media_config = MediaConfig(); | 2154 MediaConfig media_config = GetMediaConfig(); |
| 2155 media_config.video.enable_cpu_overuse_detection = true; |
2149 channel_.reset( | 2156 channel_.reset( |
2150 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); | 2157 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); |
2151 channel_->OnReadyToSend(true); | 2158 channel_->OnReadyToSend(true); |
2152 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2159 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
2153 | 2160 |
2154 AddSendStream(); | 2161 AddSendStream(); |
2155 | 2162 |
2156 cricket::FakeVideoCapturer capturer; | 2163 cricket::FakeVideoCapturer capturer; |
2157 ASSERT_EQ(cricket::CS_RUNNING, | 2164 ASSERT_EQ(cricket::CS_RUNNING, |
2158 capturer.Start(capturer.GetSupportedFormats()->front())); | 2165 capturer.Start(capturer.GetSupportedFormats()->front())); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2203 | 2210 |
2204 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); | 2211 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); |
2205 } | 2212 } |
2206 | 2213 |
2207 void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse, | 2214 void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse, |
2208 bool is_screenshare) { | 2215 bool is_screenshare) { |
2209 cricket::VideoCodec codec = GetEngineCodec("VP8"); | 2216 cricket::VideoCodec codec = GetEngineCodec("VP8"); |
2210 cricket::VideoSendParameters parameters; | 2217 cricket::VideoSendParameters parameters; |
2211 parameters.codecs.push_back(codec); | 2218 parameters.codecs.push_back(codec); |
2212 | 2219 |
2213 MediaConfig media_config = MediaConfig(); | 2220 MediaConfig media_config = GetMediaConfig(); |
2214 if (!enable_overuse) { | 2221 if (enable_overuse) { |
2215 media_config.video.enable_cpu_overuse_detection = false; | 2222 media_config.video.enable_cpu_overuse_detection = true; |
2216 } | 2223 } |
2217 channel_.reset( | 2224 channel_.reset( |
2218 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); | 2225 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); |
2219 channel_->OnReadyToSend(true); | 2226 channel_->OnReadyToSend(true); |
2220 | 2227 |
2221 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 2228 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
2222 | 2229 |
2223 AddSendStream(); | 2230 AddSendStream(); |
2224 | 2231 |
2225 cricket::FakeVideoCapturer capturer; | 2232 cricket::FakeVideoCapturer capturer; |
(...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4054 } | 4061 } |
4055 | 4062 |
4056 class WebRtcVideoChannel2SimulcastTest : public testing::Test { | 4063 class WebRtcVideoChannel2SimulcastTest : public testing::Test { |
4057 public: | 4064 public: |
4058 WebRtcVideoChannel2SimulcastTest() | 4065 WebRtcVideoChannel2SimulcastTest() |
4059 : fake_call_(webrtc::Call::Config(&event_log_)), last_ssrc_(0) {} | 4066 : fake_call_(webrtc::Call::Config(&event_log_)), last_ssrc_(0) {} |
4060 | 4067 |
4061 void SetUp() override { | 4068 void SetUp() override { |
4062 engine_.Init(); | 4069 engine_.Init(); |
4063 channel_.reset( | 4070 channel_.reset( |
4064 engine_.CreateChannel(&fake_call_, MediaConfig(), VideoOptions())); | 4071 engine_.CreateChannel(&fake_call_, GetMediaConfig(), VideoOptions())); |
4065 channel_->OnReadyToSend(true); | 4072 channel_->OnReadyToSend(true); |
4066 last_ssrc_ = 123; | 4073 last_ssrc_ = 123; |
4067 } | 4074 } |
4068 | 4075 |
4069 protected: | 4076 protected: |
4070 void VerifySimulcastSettings(const VideoCodec& codec, | 4077 void VerifySimulcastSettings(const VideoCodec& codec, |
4071 int capture_width, | 4078 int capture_width, |
4072 int capture_height, | 4079 int capture_height, |
4073 size_t num_configured_streams, | 4080 size_t num_configured_streams, |
4074 size_t expected_num_streams, | 4081 size_t expected_num_streams, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4240 } | 4247 } |
4241 | 4248 |
4242 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsForSimulcastScreenshare) { | 4249 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsForSimulcastScreenshare) { |
4243 webrtc::test::ScopedFieldTrials override_field_trials_( | 4250 webrtc::test::ScopedFieldTrials override_field_trials_( |
4244 "WebRTC-SimulcastScreenshare/Enabled/"); | 4251 "WebRTC-SimulcastScreenshare/Enabled/"); |
4245 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 2, true, | 4252 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 2, true, |
4246 true); | 4253 true); |
4247 } | 4254 } |
4248 | 4255 |
4249 } // namespace cricket | 4256 } // namespace cricket |
OLD | NEW |