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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine.cc ('k') | webrtc/video_send_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/engine/webrtcvideoengine_unittest.cc
diff --git a/webrtc/media/engine/webrtcvideoengine_unittest.cc b/webrtc/media/engine/webrtcvideoengine_unittest.cc
index d13609fb6f294d454b31331362e35aea5a645d19..e14f3267db7758549b30bac57e56985b1e7a2f6f 100644
--- a/webrtc/media/engine/webrtcvideoengine_unittest.cc
+++ b/webrtc/media/engine/webrtcvideoengine_unittest.cc
@@ -1215,6 +1215,9 @@ class WebRtcVideoChannelTest : public WebRtcVideoEngineTest {
send_stream->GetConfig().rtp.extensions[0].uri);
}
+ void TestDegradationPreference(bool resolution_scaling_enabled,
+ bool fps_scaling_enabled);
+
void TestCpuAdaptation(bool enable_overuse, bool is_screenshare);
void TestReceiverLocalSsrcConfiguration(bool receiver_first);
void TestReceiveUnsignaledSsrcPacket(uint8_t payload_type,
@@ -2097,6 +2100,24 @@ TEST_F(Vp9SettingsTestWith2SL3TLFlag, VerifySettings) {
VerifySettings(kNumSpatialLayers, kNumTemporalLayers);
}
+TEST_F(WebRtcVideoChannelTest,
+ BalancedDegradationPreferenceNotSupportedWithoutFieldtrial) {
+ webrtc::test::ScopedFieldTrials override_field_trials_(
+ "WebRTC-Video-BalancedDegradation/Disabled/");
+ const bool kResolutionScalingEnabled = true;
+ const bool kFpsScalingEnabled = false;
+ TestDegradationPreference(kResolutionScalingEnabled, kFpsScalingEnabled);
+}
+
+TEST_F(WebRtcVideoChannelTest,
+ BalancedDegradationPreferenceSupportedBehindFieldtrial) {
+ webrtc::test::ScopedFieldTrials override_field_trials_(
+ "WebRTC-Video-BalancedDegradation/Enabled/");
+ const bool kResolutionScalingEnabled = true;
+ const bool kFpsScalingEnabled = true;
+ TestDegradationPreference(kResolutionScalingEnabled, kFpsScalingEnabled);
+}
+
TEST_F(WebRtcVideoChannelTest, AdaptsOnOveruse) {
TestCpuAdaptation(true, false);
}
@@ -2263,6 +2284,40 @@ TEST_F(WebRtcVideoChannelTest, PreviousAdaptationDoesNotApplyToScreenshare) {
EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
}
+// TODO(asapersson): Remove this test when the balanced field trial is removed.
+void WebRtcVideoChannelTest::TestDegradationPreference(
+ bool resolution_scaling_enabled,
+ bool fps_scaling_enabled) {
+ cricket::VideoCodec codec = GetEngineCodec("VP8");
+ cricket::VideoSendParameters parameters;
+ parameters.codecs.push_back(codec);
+
+ MediaConfig media_config = GetMediaConfig();
+ media_config.video.enable_cpu_overuse_detection = true;
+ channel_.reset(
+ engine_.CreateChannel(fake_call_.get(), media_config, VideoOptions()));
+ channel_->OnReadyToSend(true);
+
+ EXPECT_TRUE(channel_->SetSendParameters(parameters));
+
+ AddSendStream();
+
+ cricket::FakeVideoCapturer capturer;
+ VideoOptions options;
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, &options, &capturer));
+ cricket::VideoFormat capture_format = capturer.GetSupportedFormats()->front();
+ EXPECT_EQ(cricket::CS_RUNNING, capturer.Start(capture_format));
+
+ EXPECT_TRUE(channel_->SetSend(true));
+
+ FakeVideoSendStream* send_stream = fake_call_->GetVideoSendStreams().front();
+ EXPECT_EQ(resolution_scaling_enabled,
+ send_stream->resolution_scaling_enabled());
+ EXPECT_EQ(fps_scaling_enabled, send_stream->framerate_scaling_enabled());
+
+ EXPECT_TRUE(channel_->SetVideoSend(last_ssrc_, true, nullptr, nullptr));
+}
+
void WebRtcVideoChannelTest::TestCpuAdaptation(bool enable_overuse,
bool is_screenshare) {
const int kDefaultFps = 30;
« 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