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

Unified Diff: webrtc/media/engine/webrtcvideoengine2_unittest.cc

Issue 1695663003: Drop VideoOptions from VideoSendParameters. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Let WebRtcVideoChannel2 keep construction-time default VideoOptions. Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/media/engine/webrtcvideoengine2_unittest.cc
diff --git a/webrtc/media/engine/webrtcvideoengine2_unittest.cc b/webrtc/media/engine/webrtcvideoengine2_unittest.cc
index c18f35b5e4e9730b0ca28913549caa2bc2017340..288e80efd44e74bdbe61a32d671735c34bd2607e 100644
--- a/webrtc/media/engine/webrtcvideoengine2_unittest.cc
+++ b/webrtc/media/engine/webrtcvideoengine2_unittest.cc
@@ -1041,13 +1041,12 @@ class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test {
bool expect_created_receive_stream);
FakeVideoSendStream* SetDenoisingOption(
- const cricket::VideoSendParameters& parameters,
+ uint32_t ssrc,
cricket::FakeVideoCapturer* capturer,
bool enabled) {
- cricket::VideoSendParameters params = parameters;
- params.options.video_noise_reduction = rtc::Optional<bool>(enabled);
- // TODO(nisse): Switch to using SetOptions?
- channel_->SetSendParameters(params);
+ cricket::VideoOptions options;
+ options.video_noise_reduction = rtc::Optional<bool>(enabled);
+ channel_->SetVideoSend(ssrc, true, &options);
// Options only take effect on the next frame.
EXPECT_TRUE(capturer->CaptureFrame());
@@ -1489,12 +1488,14 @@ TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) {
cricket::VideoCodec codec = kVp8Codec360p;
cricket::VideoSendParameters parameters;
parameters.codecs.push_back(codec);
- parameters.options.screencast_min_bitrate_kbps =
- rtc::Optional<int>(kScreenshareMinBitrateKbps);
EXPECT_TRUE(channel_->SetSendParameters(parameters));
-
AddSendStream();
+ VideoOptions mbr_options;
+ mbr_options.screencast_min_bitrate_kbps =
+ rtc::Optional<int>(kScreenshareMinBitrateKbps);
+ channel_->SetVideoSend(last_ssrc_, true, &mbr_options);
+
cricket::FakeVideoCapturer capturer;
EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
cricket::VideoFormat capture_format_hd =
@@ -1524,8 +1525,9 @@ TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) {
// Removing a capturer triggers a black frame to be sent.
EXPECT_EQ(2, send_stream->GetNumberOfSwappedFrames());
EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
- parameters.options.is_screencast = rtc::Optional<bool>(true);
- EXPECT_TRUE(channel_->SetSendParameters(parameters));
+ VideoOptions screencast_options;
+ screencast_options.is_screencast = rtc::Optional<bool>(true);
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &screencast_options));
EXPECT_TRUE(capturer.CaptureFrame());
// Send stream not recreated after option change.
ASSERT_EQ(send_stream, fake_call_->GetVideoSendStreams().front());
@@ -1601,11 +1603,12 @@ TEST_F(WebRtcVideoChannel2Test,
static const int kConferenceScreencastTemporalBitrateBps =
ScreenshareLayerConfig::GetDefault().tl0_bitrate_kbps * 1000;
send_parameters_.conference_mode = true;
- send_parameters_.options.is_screencast = rtc::Optional<bool>(true);
channel_->SetSendParameters(send_parameters_);
AddSendStream();
-
+ VideoOptions options;
+ options.is_screencast = rtc::Optional<bool>(true);
+ channel_->SetVideoSend(last_ssrc_, true, &options);
cricket::FakeVideoCapturer capturer;
EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
cricket::VideoFormat capture_format_hd =
@@ -1689,14 +1692,14 @@ TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) {
EXPECT_TRUE(vp8_settings.denoisingOn)
<< "VP8 denoising should be on by default.";
- stream = SetDenoisingOption(parameters, &capturer, false);
+ stream = SetDenoisingOption(last_ssrc_, &capturer, false);
ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
EXPECT_FALSE(vp8_settings.denoisingOn);
EXPECT_TRUE(vp8_settings.automaticResizeOn);
EXPECT_TRUE(vp8_settings.frameDroppingOn);
- stream = SetDenoisingOption(parameters, &capturer, true);
+ stream = SetDenoisingOption(last_ssrc_, &capturer, true);
ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
EXPECT_TRUE(vp8_settings.denoisingOn);
@@ -1716,10 +1719,11 @@ TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) {
EXPECT_TRUE(vp8_settings.frameDroppingOn);
// In screen-share mode, denoising is forced off and simulcast disabled.
- parameters.options.is_screencast = rtc::Optional<bool>(true);
- EXPECT_TRUE(channel_->SetSendParameters(parameters));
+ VideoOptions options;
+ options.is_screencast = rtc::Optional<bool>(true);
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options));
- stream = SetDenoisingOption(parameters, &capturer, false);
+ stream = SetDenoisingOption(last_ssrc_, &capturer, false);
EXPECT_EQ(1, stream->GetVideoStreams().size());
ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
@@ -1728,7 +1732,7 @@ TEST_F(WebRtcVideoChannel2Test, VerifyVp8SpecificSettings) {
EXPECT_FALSE(vp8_settings.automaticResizeOn);
EXPECT_FALSE(vp8_settings.frameDroppingOn);
- stream = SetDenoisingOption(parameters, &capturer, true);
+ stream = SetDenoisingOption(last_ssrc_, &capturer, true);
ASSERT_TRUE(stream->GetVp8Settings(&vp8_settings)) << "No VP8 config set.";
EXPECT_FALSE(vp8_settings.denoisingOn);
@@ -1781,31 +1785,32 @@ TEST_F(Vp9SettingsTest, VerifyVp9SpecificSettings) {
EXPECT_FALSE(vp9_settings.denoisingOn)
<< "VP9 denoising should be off by default.";
- stream = SetDenoisingOption(parameters, &capturer, false);
+ stream = SetDenoisingOption(last_ssrc_, &capturer, false);
ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set.";
EXPECT_FALSE(vp9_settings.denoisingOn);
// Frame dropping always on for real time video.
EXPECT_TRUE(vp9_settings.frameDroppingOn);
- stream = SetDenoisingOption(parameters, &capturer, true);
+ stream = SetDenoisingOption(last_ssrc_, &capturer, true);
ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set.";
EXPECT_TRUE(vp9_settings.denoisingOn);
EXPECT_TRUE(vp9_settings.frameDroppingOn);
// In screen-share mode, denoising is forced off.
- parameters.options.is_screencast = rtc::Optional<bool>(true);
- EXPECT_TRUE(channel_->SetSendParameters(parameters));
+ VideoOptions options;
+ options.is_screencast = rtc::Optional<bool>(true);
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options));
- stream = SetDenoisingOption(parameters, &capturer, false);
+ stream = SetDenoisingOption(last_ssrc_, &capturer, false);
ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set.";
EXPECT_FALSE(vp9_settings.denoisingOn);
// Frame dropping always off for screen sharing.
EXPECT_FALSE(vp9_settings.frameDroppingOn);
- stream = SetDenoisingOption(parameters, &capturer, false);
+ stream = SetDenoisingOption(last_ssrc_, &capturer, false);
ASSERT_TRUE(stream->GetVp9Settings(&vp9_settings)) << "No VP9 config set.";
EXPECT_FALSE(vp9_settings.denoisingOn);
@@ -1905,11 +1910,14 @@ void WebRtcVideoChannel2Test::TestCpuAdaptation(bool enable_overuse,
channel_.reset(
engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
- parameters.options.is_screencast = rtc::Optional<bool>(is_screenshare);
EXPECT_TRUE(channel_->SetSendParameters(parameters));
AddSendStream();
+ VideoOptions options;
+ options.is_screencast = rtc::Optional<bool>(is_screenshare);
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options));
+
cricket::FakeVideoCapturer capturer;
EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
EXPECT_EQ(cricket::CS_RUNNING,
@@ -3258,4 +3266,3 @@ TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
VerifySimulcastSettings(codec, 2, 2);
}
} // namespace cricket
-

Powered by Google App Engine
This is Rietveld 408576698