Account for simulcast hysteresis in padding rate calculation.
Bug: webrtc:10271
Change-Id: If0b0eb7d94fb1c892880ff4745f34c43fcdeee54
Reviewed-on: https://webrtc-review.googlesource.com/c/120661
Commit-Queue: Rasmus Brandt <brandtr@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26527}
diff --git a/rtc_base/experiments/rate_control_settings_unittest.cc b/rtc_base/experiments/rate_control_settings_unittest.cc
new file mode 100644
index 0000000..d049bc7
--- /dev/null
+++ b/rtc_base/experiments/rate_control_settings_unittest.cc
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "rtc_base/experiments/rate_control_settings.h"
+
+#include "api/video_codecs/video_codec.h"
+#include "api/video_codecs/video_encoder_config.h"
+#include "test/field_trial.h"
+#include "test/gtest.h"
+
+namespace webrtc {
+
+namespace {
+
+TEST(RateControlSettingsTest, LibvpxTrustedRateController) {
+ test::ScopedFieldTrials field_trials(
+ "WebRTC-VideoRateControl/trust_vp8:1,trust_vp9:0/");
+ const RateControlSettings rate_control_settings =
+ RateControlSettings::ParseFromFieldTrials();
+
+ EXPECT_TRUE(rate_control_settings.LibvpxVp8TrustedRateController());
+ EXPECT_FALSE(rate_control_settings.LibvpxVp9TrustedRateController());
+}
+
+TEST(RateControlSettingsTest, GetSimulcastHysteresisFactor) {
+ test::ScopedFieldTrials field_trials(
+ "WebRTC-VideoRateControl/"
+ "video_hysteresis:1.2,screenshare_hysteresis:1.4/");
+ const RateControlSettings rate_control_settings =
+ RateControlSettings::ParseFromFieldTrials();
+
+ EXPECT_EQ(rate_control_settings.GetSimulcastHysteresisFactor(
+ VideoCodecMode::kRealtimeVideo),
+ 1.2);
+ EXPECT_EQ(rate_control_settings.GetSimulcastHysteresisFactor(
+ VideoEncoderConfig::ContentType::kRealtimeVideo),
+ 1.2);
+ EXPECT_EQ(rate_control_settings.GetSimulcastHysteresisFactor(
+ VideoCodecMode::kScreensharing),
+ 1.4);
+ EXPECT_EQ(rate_control_settings.GetSimulcastHysteresisFactor(
+ VideoEncoderConfig::ContentType::kScreen),
+ 1.4);
+}
+
+} // namespace
+
+} // namespace webrtc