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

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

Issue 2923563002: Add field trial for balanced degradation preference. (Closed)
Patch Set: rebase Created 3 years, 6 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/media/engine/webrtcvideoengine.cc ('k') | webrtc/video_send_stream.h » ('j') | 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) 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 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 AddSendStream(cricket::StreamParams::CreateLegacy(123)); 1208 AddSendStream(cricket::StreamParams::CreateLegacy(123));
1209 1209
1210 // Verify that only one of them has been set, and that it is the one with 1210 // Verify that only one of them has been set, and that it is the one with
1211 // highest priority (transport sequence number). 1211 // highest priority (transport sequence number).
1212 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size()); 1212 ASSERT_EQ(1u, send_stream->GetConfig().rtp.extensions.size());
1213 EXPECT_EQ(expected_id, send_stream->GetConfig().rtp.extensions[0].id); 1213 EXPECT_EQ(expected_id, send_stream->GetConfig().rtp.extensions[0].id);
1214 EXPECT_EQ(expected_extension, 1214 EXPECT_EQ(expected_extension,
1215 send_stream->GetConfig().rtp.extensions[0].uri); 1215 send_stream->GetConfig().rtp.extensions[0].uri);
1216 } 1216 }
1217 1217
1218 void TestDegradationPreference(bool resolution_scaling_enabled,
1219 bool fps_scaling_enabled);
1220
1218 void TestCpuAdaptation(bool enable_overuse, bool is_screenshare); 1221 void TestCpuAdaptation(bool enable_overuse, bool is_screenshare);
1219 void TestReceiverLocalSsrcConfiguration(bool receiver_first); 1222 void TestReceiverLocalSsrcConfiguration(bool receiver_first);
1220 void TestReceiveUnsignaledSsrcPacket(uint8_t payload_type, 1223 void TestReceiveUnsignaledSsrcPacket(uint8_t payload_type,
1221 bool expect_created_receive_stream); 1224 bool expect_created_receive_stream);
1222 1225
1223 FakeVideoSendStream* SetDenoisingOption( 1226 FakeVideoSendStream* SetDenoisingOption(
1224 uint32_t ssrc, 1227 uint32_t ssrc,
1225 cricket::FakeVideoCapturer* capturer, 1228 cricket::FakeVideoCapturer* capturer,
1226 bool enabled) { 1229 bool enabled) {
1227 cricket::VideoOptions options; 1230 cricket::VideoOptions options;
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
2090 : Vp9SettingsTestWithFieldTrial( 2093 : Vp9SettingsTestWithFieldTrial(
2091 "WebRTC-SupportVP9SVC/EnabledByFlag_2SL3TL/") {} 2094 "WebRTC-SupportVP9SVC/EnabledByFlag_2SL3TL/") {}
2092 }; 2095 };
2093 2096
2094 TEST_F(Vp9SettingsTestWith2SL3TLFlag, VerifySettings) { 2097 TEST_F(Vp9SettingsTestWith2SL3TLFlag, VerifySettings) {
2095 const int kNumSpatialLayers = 2; 2098 const int kNumSpatialLayers = 2;
2096 const int kNumTemporalLayers = 3; 2099 const int kNumTemporalLayers = 3;
2097 VerifySettings(kNumSpatialLayers, kNumTemporalLayers); 2100 VerifySettings(kNumSpatialLayers, kNumTemporalLayers);
2098 } 2101 }
2099 2102
2103 TEST_F(WebRtcVideoChannelTest,
2104 BalancedDegradationPreferenceNotSupportedWithoutFieldtrial) {
2105 webrtc::test::ScopedFieldTrials override_field_trials_(
2106 "WebRTC-Video-BalancedDegradation/Disabled/");
2107 const bool kResolutionScalingEnabled = true;
2108 const bool kFpsScalingEnabled = false;
2109 TestDegradationPreference(kResolutionScalingEnabled, kFpsScalingEnabled);
2110 }
2111
2112 TEST_F(WebRtcVideoChannelTest,
2113 BalancedDegradationPreferenceSupportedBehindFieldtrial) {
2114 webrtc::test::ScopedFieldTrials override_field_trials_(
2115 "WebRTC-Video-BalancedDegradation/Enabled/");
2116 const bool kResolutionScalingEnabled = true;
2117 const bool kFpsScalingEnabled = true;
2118 TestDegradationPreference(kResolutionScalingEnabled, kFpsScalingEnabled);
2119 }
2120
2100 TEST_F(WebRtcVideoChannelTest, AdaptsOnOveruse) { 2121 TEST_F(WebRtcVideoChannelTest, AdaptsOnOveruse) {
2101 TestCpuAdaptation(true, false); 2122 TestCpuAdaptation(true, false);
2102 } 2123 }
2103 2124
2104 TEST_F(WebRtcVideoChannelTest, DoesNotAdaptOnOveruseWhenDisabled) { 2125 TEST_F(WebRtcVideoChannelTest, DoesNotAdaptOnOveruseWhenDisabled) {
2105 TestCpuAdaptation(false, false); 2126 TestCpuAdaptation(false, false);
2106 } 2127 }
2107 2128
2108 TEST_F(WebRtcVideoChannelTest, DoesNotAdaptOnOveruseWhenScreensharing) { 2129 TEST_F(WebRtcVideoChannelTest, DoesNotAdaptOnOveruseWhenScreensharing) {
2109 TestCpuAdaptation(true, true); 2130 TestCpuAdaptation(true, true);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 EXPECT_TRUE(capturer.CaptureCustomFrame(1280, 720, cricket::FOURCC_I420)); 2277 EXPECT_TRUE(capturer.CaptureCustomFrame(1280, 720, cricket::FOURCC_I420));
2257 ASSERT_EQ(3, fake_call_->GetNumCreatedSendStreams()); 2278 ASSERT_EQ(3, fake_call_->GetNumCreatedSendStreams());
2258 send_stream = fake_call_->GetVideoSendStreams().front(); 2279 send_stream = fake_call_->GetVideoSendStreams().front();
2259 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames()); 2280 EXPECT_EQ(1, send_stream->GetNumberOfSwappedFrames());
2260 EXPECT_EQ(1280 * 3 / 4, send_stream->GetLastWidth()); 2281 EXPECT_EQ(1280 * 3 / 4, send_stream->GetLastWidth());
2261 EXPECT_EQ(720 * 3 / 4, send_stream->GetLastHeight()); 2282 EXPECT_EQ(720 * 3 / 4, send_stream->GetLastHeight());
2262 2283
2263 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr)); 2284 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
2264 } 2285 }
2265 2286
2287 // TODO(asapersson): Remove this test when the balanced field trial is removed.
2288 void WebRtcVideoChannelTest::TestDegradationPreference(
2289 bool resolution_scaling_enabled,
2290 bool fps_scaling_enabled) {
2291 cricket::VideoCodec codec = GetEngineCodec("VP8");
2292 cricket::VideoSendParameters parameters;
2293 parameters.codecs.push_back(codec);
2294
2295 MediaConfig media_config = GetMediaConfig();
2296 media_config.video.enable_cpu_overuse_detection = true;
2297 channel_.reset(
2298 engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
2299 channel_->OnReadyToSend(true);
2300
2301 EXPECT_TRUE(channel_->SetSendParameters(parameters));
2302
2303 AddSendStream();
2304
2305 cricket::FakeVideoCapturer capturer;
2306 VideoOptions options;
2307 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
2308 cricket::VideoFormat capture_format = capturer.GetSupportedFormats()->front();
2309 EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format));
2310
2311 EXPECT_TRUE(channel_->SetSend(true));
2312
2313 FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front();
2314 EXPECT_EQ(resolution_scaling_enabled,
2315 send_stream->resolution_scaling_enabled());
2316 EXPECT_EQ(fps_scaling_enabled, send_stream->framerate_scaling_enabled());
2317
2318 EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
2319 }
2320
2266 void WebRtcVideoChannelTest::TestCpuAdaptation(bool enable_overuse, 2321 void WebRtcVideoChannelTest::TestCpuAdaptation(bool enable_overuse,
2267 bool is_screenshare) { 2322 bool is_screenshare) {
2268 const int kDefaultFps = 30; 2323 const int kDefaultFps = 30;
2269 cricket::VideoCodec codec = GetEngineCodec("VP8"); 2324 cricket::VideoCodec codec = GetEngineCodec("VP8");
2270 cricket::VideoSendParameters parameters; 2325 cricket::VideoSendParameters parameters;
2271 parameters.codecs.push_back(codec); 2326 parameters.codecs.push_back(codec);
2272 2327
2273 MediaConfig media_config = GetMediaConfig(); 2328 MediaConfig media_config = GetMediaConfig();
2274 if (enable_overuse) { 2329 if (enable_overuse) {
2275 media_config.video.enable_cpu_overuse_detection = true; 2330 media_config.video.enable_cpu_overuse_detection = true;
(...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after
4626 4681
4627 TEST_F(WebRtcVideoChannelSimulcastTest, 4682 TEST_F(WebRtcVideoChannelSimulcastTest,
4628 NoSimulcastScreenshareWithoutConference) { 4683 NoSimulcastScreenshareWithoutConference) {
4629 webrtc::test::ScopedFieldTrials override_field_trials_( 4684 webrtc::test::ScopedFieldTrials override_field_trials_(
4630 "WebRTC-SimulcastScreenshare/Enabled/"); 4685 "WebRTC-SimulcastScreenshare/Enabled/");
4631 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 1, true, 4686 VerifySimulcastSettings(cricket::VideoCodec("VP8"), 1280, 720, 3, 1, true,
4632 false); 4687 false);
4633 } 4688 }
4634 4689
4635 } // namespace cricket 4690 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine.cc ('k') | webrtc/video_send_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698