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}
This commit is contained in:
Rasmus Brandt
2019-02-04 11:09:46 +01:00
committed by Commit Bot
parent 819661a965
commit c402dbe2b0
11 changed files with 185 additions and 25 deletions

View File

@ -125,6 +125,7 @@ rtc_static_library("rate_control_settings") {
"../:rtc_base_approved",
"../../api/transport:field_trial_based_config",
"../../api/transport:webrtc_key_value_config",
"../../api/video_codecs:video_codecs_api",
"../../system_wrappers:field_trial",
"//third_party/abseil-cpp/absl/memory:memory",
"//third_party/abseil-cpp/absl/types:optional",
@ -141,6 +142,7 @@ if (rtc_include_tests) {
"field_trial_units_unittest.cc",
"normalize_simulcast_size_experiment_unittest.cc",
"quality_scaling_experiment_unittest.cc",
"rate_control_settings_unittest.cc",
"rtt_mult_experiment_unittest.cc",
]
deps = [
@ -148,10 +150,12 @@ if (rtc_include_tests) {
":field_trial_parser",
":normalize_simulcast_size_experiment",
":quality_scaling_experiment",
":rate_control_settings",
":rtt_mult_experiment",
"..:gunit_helpers",
"../:rtc_base_tests_main",
"../:rtc_base_tests_utils",
"../../api/video_codecs:video_codecs_api",
"../../system_wrappers:field_trial",
"../../test:field_trial",
"../../test:test_support",

View File

@ -178,6 +178,22 @@ bool RateControlSettings::LibvpxVp9TrustedRateController() const {
return trust_vp9_.Get();
}
double RateControlSettings::GetSimulcastHysteresisFactor(
VideoCodecMode mode) const {
if (mode == VideoCodecMode::kScreensharing) {
return GetSimulcastScreenshareHysteresisFactor();
}
return GetSimulcastVideoHysteresisFactor();
}
double RateControlSettings::GetSimulcastHysteresisFactor(
VideoEncoderConfig::ContentType content_type) const {
if (content_type == VideoEncoderConfig::ContentType::kScreen) {
return GetSimulcastScreenshareHysteresisFactor();
}
return GetSimulcastVideoHysteresisFactor();
}
double RateControlSettings::GetSimulcastVideoHysteresisFactor() const {
return video_hysteresis_.Get();
}

View File

@ -13,6 +13,8 @@
#include "absl/types/optional.h"
#include "api/transport/webrtc_key_value_config.h"
#include "api/video_codecs/video_codec.h"
#include "api/video_codecs/video_encoder_config.h"
#include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/experiments/field_trial_units.h"
@ -41,8 +43,11 @@ class RateControlSettings final {
bool LibvpxVp8TrustedRateController() const;
bool LibvpxVp9TrustedRateController() const;
double GetSimulcastVideoHysteresisFactor() const;
double GetSimulcastScreenshareHysteresisFactor() const;
// TODO(bugs.webrtc.org/10272): Remove one of these when we have merged
// VideoCodecMode and VideoEncoderConfig::ContentType.
double GetSimulcastHysteresisFactor(VideoCodecMode mode) const;
double GetSimulcastHysteresisFactor(
VideoEncoderConfig::ContentType content_type) const;
bool TriggerProbeOnMaxAllocatedBitrateChange() const;
@ -50,6 +55,9 @@ class RateControlSettings final {
explicit RateControlSettings(
const WebRtcKeyValueConfig* const key_value_config);
double GetSimulcastVideoHysteresisFactor() const;
double GetSimulcastScreenshareHysteresisFactor() const;
FieldTrialOptional<int> congestion_window_;
FieldTrialOptional<int> congestion_window_pushback_;
FieldTrialOptional<double> pacing_factor_;

View File

@ -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