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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2_unittest.cc

Issue 2504783002: Revert of Start probes only after network is connected. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 334 }
335 335
336 TEST_F(WebRtcVideoEngine2Test, UseExternalFactoryForVp8WhenSupported) { 336 TEST_F(WebRtcVideoEngine2Test, UseExternalFactoryForVp8WhenSupported) {
337 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; 337 cricket::FakeWebRtcVideoEncoderFactory encoder_factory;
338 encoder_factory.AddSupportedVideoCodecType("VP8"); 338 encoder_factory.AddSupportedVideoCodecType("VP8");
339 cricket::VideoSendParameters parameters; 339 cricket::VideoSendParameters parameters;
340 parameters.codecs.push_back(kVp8Codec); 340 parameters.codecs.push_back(kVp8Codec);
341 341
342 std::unique_ptr<VideoMediaChannel> channel( 342 std::unique_ptr<VideoMediaChannel> channel(
343 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs)); 343 SetUpForExternalEncoderFactory(&encoder_factory, parameters.codecs));
344 channel->OnReadyToSend(true);
345 344
346 EXPECT_TRUE( 345 EXPECT_TRUE(
347 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc))); 346 channel->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc)));
348 EXPECT_EQ(0, encoder_factory.GetNumCreatedEncoders()); 347 EXPECT_EQ(0, encoder_factory.GetNumCreatedEncoders());
349 EXPECT_TRUE(channel->SetSend(true)); 348 EXPECT_TRUE(channel->SetSend(true));
350 cricket::FakeVideoCapturer capturer; 349 cricket::FakeVideoCapturer capturer;
351 EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer)); 350 EXPECT_TRUE(channel->SetVideoSend(kSsrc, true, nullptr, &capturer));
352 EXPECT_EQ(cricket::CS_RUNNING, 351 EXPECT_EQ(cricket::CS_RUNNING,
353 capturer.Start(capturer.GetSupportedFormats()->front())); 352 capturer.Start(capturer.GetSupportedFormats()->front()));
354 EXPECT_TRUE(capturer.CaptureFrame()); 353 EXPECT_TRUE(capturer.CaptureFrame());
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { 861 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test {
863 public: 862 public:
864 WebRtcVideoChannel2Test() : WebRtcVideoChannel2Test("") {} 863 WebRtcVideoChannel2Test() : WebRtcVideoChannel2Test("") {}
865 explicit WebRtcVideoChannel2Test(const char* field_trials) 864 explicit WebRtcVideoChannel2Test(const char* field_trials)
866 : WebRtcVideoEngine2Test(field_trials), last_ssrc_(0) {} 865 : WebRtcVideoEngine2Test(field_trials), last_ssrc_(0) {}
867 void SetUp() override { 866 void SetUp() override {
868 fake_call_.reset(new FakeCall(webrtc::Call::Config(&event_log_))); 867 fake_call_.reset(new FakeCall(webrtc::Call::Config(&event_log_)));
869 engine_.Init(); 868 engine_.Init();
870 channel_.reset( 869 channel_.reset(
871 engine_.CreateChannel(fake_call_.get(), MediaConfig(), VideoOptions())); 870 engine_.CreateChannel(fake_call_.get(), MediaConfig(), VideoOptions()));
872 channel_->OnReadyToSend(true);
873 last_ssrc_ = 123; 871 last_ssrc_ = 123;
874 send_parameters_.codecs = engine_.codecs(); 872 send_parameters_.codecs = engine_.codecs();
875 recv_parameters_.codecs = engine_.codecs(); 873 recv_parameters_.codecs = engine_.codecs();
876 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); 874 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_));
877 } 875 }
878 876
879 protected: 877 protected:
880 FakeVideoSendStream* AddSendStream() { 878 FakeVideoSendStream* AddSendStream() {
881 return AddSendStream(StreamParams::CreateLegacy(++last_ssrc_)); 879 return AddSendStream(StreamParams::CreateLegacy(++last_ssrc_));
882 } 880 }
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 FakeVideoSendStream* stream = AddSendStream(); 1676 FakeVideoSendStream* stream = AddSendStream();
1679 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); 1677 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate);
1680 } 1678 }
1681 1679
1682 TEST_F(WebRtcVideoChannel2Test, SetMediaConfigSuspendBelowMinBitrate) { 1680 TEST_F(WebRtcVideoChannel2Test, SetMediaConfigSuspendBelowMinBitrate) {
1683 MediaConfig media_config = MediaConfig(); 1681 MediaConfig media_config = MediaConfig();
1684 media_config.video.suspend_below_min_bitrate = true; 1682 media_config.video.suspend_below_min_bitrate = true;
1685 1683
1686 channel_.reset( 1684 channel_.reset(
1687 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); 1685 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
1688 channel_->OnReadyToSend(true);
1689 1686
1690 channel_->SetSendParameters(send_parameters_); 1687 channel_->SetSendParameters(send_parameters_);
1691 1688
1692 FakeVideoSendStream* stream = AddSendStream(); 1689 FakeVideoSendStream* stream = AddSendStream();
1693 EXPECT_TRUE(stream->GetConfig().suspend_below_min_bitrate); 1690 EXPECT_TRUE(stream->GetConfig().suspend_below_min_bitrate);
1694 1691
1695 media_config.video.suspend_below_min_bitrate = false; 1692 media_config.video.suspend_below_min_bitrate = false;
1696 channel_.reset( 1693 channel_.reset(
1697 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); 1694 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
1698 channel_->OnReadyToSend(true);
1699 1695
1700 channel_->SetSendParameters(send_parameters_); 1696 channel_->SetSendParameters(send_parameters_);
1701 1697
1702 stream = AddSendStream(); 1698 stream = AddSendStream();
1703 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate); 1699 EXPECT_FALSE(stream->GetConfig().suspend_below_min_bitrate);
1704 } 1700 }
1705 1701
1706 TEST_F(WebRtcVideoChannel2Test, Vp8DenoisingEnabledByDefault) { 1702 TEST_F(WebRtcVideoChannel2Test, Vp8DenoisingEnabledByDefault) {
1707 FakeVideoSendStream* stream = AddSendStream(); 1703 FakeVideoSendStream* stream = AddSendStream();
1708 webrtc::VideoCodecVP8 vp8_settings; 1704 webrtc::VideoCodecVP8 vp8_settings;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 } 1969 }
1974 1970
1975 TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) { 1971 TEST_F(WebRtcVideoChannel2Test, AdaptsOnOveruseAndChangeResolution) {
1976 cricket::VideoCodec codec = kVp8Codec; 1972 cricket::VideoCodec codec = kVp8Codec;
1977 cricket::VideoSendParameters parameters; 1973 cricket::VideoSendParameters parameters;
1978 parameters.codecs.push_back(codec); 1974 parameters.codecs.push_back(codec);
1979 1975
1980 MediaConfig media_config = MediaConfig(); 1976 MediaConfig media_config = MediaConfig();
1981 channel_.reset( 1977 channel_.reset(
1982 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); 1978 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
1983 channel_->OnReadyToSend(true);
1984 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 1979 ASSERT_TRUE(channel_->SetSendParameters(parameters));
1985 1980
1986 AddSendStream(); 1981 AddSendStream();
1987 1982
1988 cricket::FakeVideoCapturer capturer; 1983 cricket::FakeVideoCapturer capturer;
1989 ASSERT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer)); 1984 ASSERT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, &capturer));
1990 ASSERT_EQ(cricket::CS_RUNNING, 1985 ASSERT_EQ(cricket::CS_RUNNING,
1991 capturer.Start(capturer.GetSupportedFormats()->front())); 1986 capturer.Start(capturer.GetSupportedFormats()->front()));
1992 ASSERT_TRUE(channel_->SetSend(true)); 1987 ASSERT_TRUE(channel_->SetSend(true));
1993 1988
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 } 2043 }
2049 2044
2050 TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) { 2045 TEST_F(WebRtcVideoChannel2Test, PreviousAdaptationDoesNotApplyToScreenshare) {
2051 cricket::VideoCodec codec = kVp8Codec; 2046 cricket::VideoCodec codec = kVp8Codec;
2052 cricket::VideoSendParameters parameters; 2047 cricket::VideoSendParameters parameters;
2053 parameters.codecs.push_back(codec); 2048 parameters.codecs.push_back(codec);
2054 2049
2055 MediaConfig media_config = MediaConfig(); 2050 MediaConfig media_config = MediaConfig();
2056 channel_.reset( 2051 channel_.reset(
2057 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); 2052 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
2058 channel_->OnReadyToSend(true);
2059 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 2053 ASSERT_TRUE(channel_->SetSendParameters(parameters));
2060 2054
2061 AddSendStream(); 2055 AddSendStream();
2062 2056
2063 cricket::FakeVideoCapturer capturer; 2057 cricket::FakeVideoCapturer capturer;
2064 ASSERT_EQ(cricket::CS_RUNNING, 2058 ASSERT_EQ(cricket::CS_RUNNING,
2065 capturer.Start(capturer.GetSupportedFormats()->front())); 2059 capturer.Start(capturer.GetSupportedFormats()->front()));
2066 ASSERT_TRUE(channel_->SetSend(true)); 2060 ASSERT_TRUE(channel_->SetSend(true));
2067 cricket::VideoOptions camera_options; 2061 cricket::VideoOptions camera_options;
2068 camera_options.is_screencast = rtc::Optional<bool>(false); 2062 camera_options.is_screencast = rtc::Optional<bool>(false);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 cricket::VideoCodec codec = kVp8Codec; 2110 cricket::VideoCodec codec = kVp8Codec;
2117 cricket::VideoSendParameters parameters; 2111 cricket::VideoSendParameters parameters;
2118 parameters.codecs.push_back(codec); 2112 parameters.codecs.push_back(codec);
2119 2113
2120 MediaConfig media_config = MediaConfig(); 2114 MediaConfig media_config = MediaConfig();
2121 if (!enable_overuse) { 2115 if (!enable_overuse) {
2122 media_config.video.enable_cpu_overuse_detection = false; 2116 media_config.video.enable_cpu_overuse_detection = false;
2123 } 2117 }
2124 channel_.reset( 2118 channel_.reset(
2125 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions())); 2119 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
2126 channel_->OnReadyToSend(true);
2127 2120
2128 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 2121 EXPECT_TRUE(channel_->SetSendParameters(parameters));
2129 2122
2130 AddSendStream(); 2123 AddSendStream();
2131 2124
2132 cricket::FakeVideoCapturer capturer; 2125 cricket::FakeVideoCapturer capturer;
2133 VideoOptions options; 2126 VideoOptions options;
2134 options.is_screencast = rtc::Optional<bool>(is_screenshare); 2127 options.is_screencast = rtc::Optional<bool>(is_screenshare);
2135 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer)); 2128 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
2136 cricket::VideoFormat capture_format = capturer.GetSupportedFormats()->front(); 2129 cricket::VideoFormat capture_format = capturer.GetSupportedFormats()->front();
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
3613 3606
3614 class WebRtcVideoChannel2SimulcastTest : public testing::Test { 3607 class WebRtcVideoChannel2SimulcastTest : public testing::Test {
3615 public: 3608 public:
3616 WebRtcVideoChannel2SimulcastTest() 3609 WebRtcVideoChannel2SimulcastTest()
3617 : fake_call_(webrtc::Call::Config(&event_log_)) {} 3610 : fake_call_(webrtc::Call::Config(&event_log_)) {}
3618 3611
3619 void SetUp() override { 3612 void SetUp() override {
3620 engine_.Init(); 3613 engine_.Init();
3621 channel_.reset( 3614 channel_.reset(
3622 engine_.CreateChannel(&fake_call_, MediaConfig(), VideoOptions())); 3615 engine_.CreateChannel(&fake_call_, MediaConfig(), VideoOptions()));
3623 channel_->OnReadyToSend(true);
3624 last_ssrc_ = 123; 3616 last_ssrc_ = 123;
3625 } 3617 }
3626 3618
3627 protected: 3619 protected:
3628 void VerifySimulcastSettings(const VideoCodec& codec, 3620 void VerifySimulcastSettings(const VideoCodec& codec,
3629 int capture_width, 3621 int capture_width,
3630 int capture_height, 3622 int capture_height,
3631 size_t num_configured_streams, 3623 size_t num_configured_streams,
3632 size_t expected_num_streams) { 3624 size_t expected_num_streams) {
3633 cricket::VideoSendParameters parameters; 3625 cricket::VideoSendParameters parameters;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3746 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) { 3738 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWith3SimulcastStreams) {
3747 VerifySimulcastSettings(kVp8Codec, 1280, 720, 3, 3); 3739 VerifySimulcastSettings(kVp8Codec, 1280, 720, 3, 3);
3748 } 3740 }
3749 3741
3750 // Test that we normalize send codec format size in simulcast. 3742 // Test that we normalize send codec format size in simulcast.
3751 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3743 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3752 cricket::VideoCodec codec(kVp8Codec); 3744 cricket::VideoCodec codec(kVp8Codec);
3753 VerifySimulcastSettings(codec, 541, 271, 2, 2); 3745 VerifySimulcastSettings(codec, 541, 271, 2, 2);
3754 } 3746 }
3755 } // namespace cricket 3747 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/base/videoengine_unittest.h ('k') | webrtc/modules/congestion_controller/congestion_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698