| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 VideoMediaInfo info; | 344 VideoMediaInfo info; |
| 345 channel->GetStats(&info); | 345 channel->GetStats(&info); |
| 346 } | 346 } |
| 347 | 347 |
| 348 TEST_F(WebRtcVideoEngine2Test, UseExternalFactoryForVp8WhenSupported) { | 348 TEST_F(WebRtcVideoEngine2Test, UseExternalFactoryForVp8WhenSupported) { |
| 349 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 349 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 350 encoder_factory.AddSupportedVideoCodecType("VP8"); | 350 encoder_factory.AddSupportedVideoCodecType("VP8"); |
| 351 | 351 |
| 352 std::unique_ptr<VideoMediaChannel> channel( | 352 std::unique_ptr<VideoMediaChannel> channel( |
| 353 SetUpForExternalEncoderFactory(&encoder_factory)); | 353 SetUpForExternalEncoderFactory(&encoder_factory)); |
| 354 channel->OnReadyToSend(true); |
| 354 | 355 |
| 355 EXPECT_TRUE( | 356 EXPECT_TRUE( |
| 356 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); | 357 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); |
| 357 EXPECT_EQ(0, encoder_factory.GetNumCreatedEncoders()); | 358 EXPECT_EQ(0, encoder_factory.GetNumCreatedEncoders()); |
| 358 EXPECT_TRUE(channel->SetSend(true)); | 359 EXPECT_TRUE(channel->SetSend(true)); |
| 359 cricket::FakeVideoCapturer capturer; | 360 cricket::FakeVideoCapturer capturer; |
| 360 EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer)); | 361 EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer)); |
| 361 EXPECT_EQ(cricket::CS_RUNNING, | 362 EXPECT_EQ(cricket::CS_RUNNING, |
| 362 capturer.Start(capturer.GetSupportedFormats()->front())); | 363 capturer.Start(capturer.GetSupportedFormats()->front())); |
| 363 EXPECT_TRUE(capturer.CaptureFrame()); | 364 EXPECT_TRUE(capturer.CaptureFrame()); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { | 908 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { |
| 908 public: | 909 public: |
| 909 WebRtcVideoChannel2Test() : WebRtcVideoChannel2Test("") {} | 910 WebRtcVideoChannel2Test() : WebRtcVideoChannel2Test("") {} |
| 910 explicit WebRtcVideoChannel2Test(const char* field_trials) | 911 explicit WebRtcVideoChannel2Test(const char* field_trials) |
| 911 : WebRtcVideoEngine2Test(field_trials), last_ssrc_(0) {} | 912 : WebRtcVideoEngine2Test(field_trials), last_ssrc_(0) {} |
| 912 void SetUp() override { | 913 void SetUp() override { |
| 913 fake_call_.reset(new FakeCall(webrtc::Call::Config(&event_log_))); | 914 fake_call_.reset(new FakeCall(webrtc::Call::Config(&event_log_))); |
| 914 engine_.Init(); | 915 engine_.Init(); |
| 915 channel_.reset( | 916 channel_.reset( |
| 916 engine_.CreateChannel(fake_call_.get(), MediaConfig(), VideoOptions())); | 917 engine_.CreateChannel(fake_call_.get(), MediaConfig(), VideoOptions())); |
| 918 channel_->OnReadyToSend(true); |
| 917 last_ssrc_ = 123; | 919 last_ssrc_ = 123; |
| 918 send_parameters_.codecs = engine_.codecs(); | 920 send_parameters_.codecs = engine_.codecs(); |
| 919 recv_parameters_.codecs = engine_.codecs(); | 921 recv_parameters_.codecs = engine_.codecs(); |
| 920 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); | 922 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 921 } | 923 } |
| 922 | 924 |
| 923 protected: | 925 protected: |
| 924 FakeVideoSendStream* AddSendStream() { | 926 FakeVideoSendStream* AddSendStream() { |
| 925 return AddSendStream(StreamParams::CreateLegacy(++last_ssrc_)); | 927 return AddSendStream(StreamParams::CreateLegacy(++last_ssrc_)); |
| 926 } | 928 } |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1722 FakeVideoSendStream* stream = AddSendStream(); | 1724 FakeVideoSendStream* stream = AddSendStream(); |
| 1723 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); | 1725 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); |
| 1724 } | 1726 } |
| 1725 | 1727 |
| 1726 TEST_F(WebRtcVideoChannel2Test, SetMediaConfigSuspendBelowMinBitrate) { | 1728 TEST_F(WebRtcVideoChannel2Test, SetMediaConfigSuspendBelowMinBitrate) { |
| 1727 MediaConfig media_config = MediaConfig(); | 1729 MediaConfig media_config = MediaConfig(); |
| 1728 media_config.video.suspend_below_min_bitrate = true; | 1730 media_config.video.suspend_below_min_bitrate = true; |
| 1729 | 1731 |
| 1730 channel_.reset( | 1732 channel_.reset( |
| 1731 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); | 1733 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); |
| 1734 channel_->OnReadyToSend(true); |
| 1732 | 1735 |
| 1733 channel_->SetSendParameters(send_parameters_); | 1736 channel_->SetSendParameters(send_parameters_); |
| 1734 | 1737 |
| 1735 FakeVideoSendStream* stream = AddSendStream(); | 1738 FakeVideoSendStream* stream = AddSendStream(); |
| 1736 EXPECT_TRUE(stream->GetConfig().suspend_below_min_bitrate); | 1739 EXPECT_TRUE(stream->GetConfig().suspend_below_min_bitrate); |
| 1737 | 1740 |
| 1738 media_config.video.suspend_below_min_bitrate = false; | 1741 media_config.video.suspend_below_min_bitrate = false; |
| 1739 channel_.reset( | 1742 channel_.reset( |
| 1740 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); | 1743 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); |
| 1744 channel_->OnReadyToSend(true); |
| 1741 | 1745 |
| 1742 channel_->SetSendParameters(send_parameters_); | 1746 channel_->SetSendParameters(send_parameters_); |
| 1743 | 1747 |
| 1744 stream = AddSendStream(); | 1748 stream = AddSendStream(); |
| 1745 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); | 1749 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); |
| 1746 } | 1750 } |
| 1747 | 1751 |
| 1748 TEST_F(WebRtcVideoChannel2Test, Vp8DenoisingEnabledByDefault) { | 1752 TEST_F(WebRtcVideoChannel2Test, Vp8DenoisingEnabledByDefault) { |
| 1749 FakeVideoSendStream* stream = AddSendStream(); | 1753 FakeVideoSendStream* stream = AddSendStream(); |
| 1750 webrtc::VideoCodecVP8 vp8_settings; | 1754 webrtc::VideoCodecVP8 vp8_settings; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2015 } | 2019 } |
| 2016 | 2020 |
| 2017 TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) { | 2021 TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) { |
| 2018 cricket::VideoCodec codec = GetEngineCodec("VP8"); | 2022 cricket::VideoCodec codec = GetEngineCodec("VP8"); |
| 2019 cricket::VideoSendParameters parameters; | 2023 cricket::VideoSendParameters parameters; |
| 2020 parameters.codecs.push_back(codec); | 2024 parameters.codecs.push_back(codec); |
| 2021 | 2025 |
| 2022 MediaConfig media_config = MediaConfig(); | 2026 MediaConfig media_config = MediaConfig(); |
| 2023 channel_.reset( | 2027 channel_.reset( |
| 2024 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); | 2028 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); |
| 2029 channel_->OnReadyToSend(true); |
| 2025 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2030 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
| 2026 | 2031 |
| 2027 AddSendStream(); | 2032 AddSendStream(); |
| 2028 | 2033 |
| 2029 cricket::FakeVideoCapturer capturer; | 2034 cricket::FakeVideoCapturer capturer; |
| 2030 ASSERT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); | 2035 ASSERT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); |
| 2031 ASSERT_EQ(cricket::CS_RUNNING, | 2036 ASSERT_EQ(cricket::CS_RUNNING, |
| 2032 capturer.Start(capturer.GetSupportedFormats()->front())); | 2037 capturer.Start(capturer.GetSupportedFormats()->front())); |
| 2033 ASSERT_TRUE(channel_->SetSend(true)); | 2038 ASSERT_TRUE(channel_->SetSend(true)); |
| 2034 | 2039 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2089 } | 2094 } |
| 2090 | 2095 |
| 2091 TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) { | 2096 TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) { |
| 2092 cricket::VideoCodec codec = GetEngineCodec("VP8"); | 2097 cricket::VideoCodec codec = GetEngineCodec("VP8"); |
| 2093 cricket::VideoSendParameters parameters; | 2098 cricket::VideoSendParameters parameters; |
| 2094 parameters.codecs.push_back(codec); | 2099 parameters.codecs.push_back(codec); |
| 2095 | 2100 |
| 2096 MediaConfig media_config = MediaConfig(); | 2101 MediaConfig media_config = MediaConfig(); |
| 2097 channel_.reset( | 2102 channel_.reset( |
| 2098 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); | 2103 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); |
| 2104 channel_->OnReadyToSend(true); |
| 2099 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 2105 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
| 2100 | 2106 |
| 2101 AddSendStream(); | 2107 AddSendStream(); |
| 2102 | 2108 |
| 2103 cricket::FakeVideoCapturer capturer; | 2109 cricket::FakeVideoCapturer capturer; |
| 2104 ASSERT_EQ(cricket::CS_RUNNING, | 2110 ASSERT_EQ(cricket::CS_RUNNING, |
| 2105 capturer.Start(capturer.GetSupportedFormats()->front())); | 2111 capturer.Start(capturer.GetSupportedFormats()->front())); |
| 2106 ASSERT_TRUE(channel_->SetSend(true)); | 2112 ASSERT_TRUE(channel_->SetSend(true)); |
| 2107 cricket::VideoOptions camera_options; | 2113 cricket::VideoOptions camera_options; |
| 2108 camera_options.is_screencast = rtc::Optional<bool>(false); | 2114 camera_options.is_screencast = rtc::Optional<bool>(false); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 cricket::VideoCodec codec = GetEngineCodec("VP8"); | 2162 cricket::VideoCodec codec = GetEngineCodec("VP8"); |
| 2157 cricket::VideoSendParameters parameters; | 2163 cricket::VideoSendParameters parameters; |
| 2158 parameters.codecs.push_back(codec); | 2164 parameters.codecs.push_back(codec); |
| 2159 | 2165 |
| 2160 MediaConfig media_config = MediaConfig(); | 2166 MediaConfig media_config = MediaConfig(); |
| 2161 if (!enable_overuse) { | 2167 if (!enable_overuse) { |
| 2162 media_config.video.enable_cpu_overuse_detection = false; | 2168 media_config.video.enable_cpu_overuse_detection = false; |
| 2163 } | 2169 } |
| 2164 channel_.reset( | 2170 channel_.reset( |
| 2165 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); | 2171 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); |
| 2172 channel_->OnReadyToSend(true); |
| 2166 | 2173 |
| 2167 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 2174 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
| 2168 | 2175 |
| 2169 AddSendStream(); | 2176 AddSendStream(); |
| 2170 | 2177 |
| 2171 cricket::FakeVideoCapturer capturer; | 2178 cricket::FakeVideoCapturer capturer; |
| 2172 VideoOptions options; | 2179 VideoOptions options; |
| 2173 options.is_screencast = rtc::Optional<bool>(is_screenshare); | 2180 options.is_screencast = rtc::Optional<bool>(is_screenshare); |
| 2174 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); | 2181 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); |
| 2175 cricket::VideoFormat capture_format = capturer.GetSupportedFormats()->front(); | 2182 cricket::VideoFormat capture_format = capturer.GetSupportedFormats()->front(); |
| (...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3683 | 3690 |
| 3684 class WebRtcVideoChannel2SimulcastTest : public testing::Test { | 3691 class WebRtcVideoChannel2SimulcastTest : public testing::Test { |
| 3685 public: | 3692 public: |
| 3686 WebRtcVideoChannel2SimulcastTest() | 3693 WebRtcVideoChannel2SimulcastTest() |
| 3687 : fake_call_(webrtc::Call::Config(&event_log_)) {} | 3694 : fake_call_(webrtc::Call::Config(&event_log_)) {} |
| 3688 | 3695 |
| 3689 void SetUp() override { | 3696 void SetUp() override { |
| 3690 engine_.Init(); | 3697 engine_.Init(); |
| 3691 channel_.reset( | 3698 channel_.reset( |
| 3692 engine_.CreateChannel(&fake_call_, MediaConfig(), VideoOptions())); | 3699 engine_.CreateChannel(&fake_call_, MediaConfig(), VideoOptions())); |
| 3700 channel_->OnReadyToSend(true); |
| 3693 last_ssrc_ = 123; | 3701 last_ssrc_ = 123; |
| 3694 } | 3702 } |
| 3695 | 3703 |
| 3696 protected: | 3704 protected: |
| 3697 void VerifySimulcastSettings(const VideoCodec& codec, | 3705 void VerifySimulcastSettings(const VideoCodec& codec, |
| 3698 int capture_width, | 3706 int capture_width, |
| 3699 int capture_height, | 3707 int capture_height, |
| 3700 size_t num_configured_streams, | 3708 size_t num_configured_streams, |
| 3701 size_t expected_num_streams) { | 3709 size_t expected_num_streams) { |
| 3702 cricket::VideoSendParameters parameters; | 3710 cricket::VideoSendParameters parameters; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3814 | 3822 |
| 3815 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) { | 3823 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) { |
| 3816 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 3); | 3824 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 3); |
| 3817 } | 3825 } |
| 3818 | 3826 |
| 3819 // Test that we normalize send codec format size in simulcast. | 3827 // Test that we normalize send codec format size in simulcast. |
| 3820 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { | 3828 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { |
| 3821 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 541, 271, 2, 2); | 3829 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 541, 271, 2, 2); |
| 3822 } | 3830 } |
| 3823 } // namespace cricket | 3831 } // namespace cricket |
| OLD | NEW |