Implement encoder overshoot detector and rate adjuster.
The overshoot detector uses a simple pacer model to determine an
estimate of how much the encoder is overusing the target bitrate.
This utilization factor can then be adjuster for when configuring the
actual target bitrate.
Spatial layers (simulcast streams) are adjusted separately.
Temporal layers are measured separately, but are combined into a single
utilization factor per spatial layer.
Bug: webrtc:10155
Change-Id: I8ea58dc6c4871e880553d7c22202f11cb2feb216
Reviewed-on: https://webrtc-review.googlesource.com/c/114886
Commit-Queue: Erik Språng <sprang@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Rasmus Brandt <brandtr@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26573}
diff --git a/rtc_base/experiments/rate_control_settings.cc b/rtc_base/experiments/rate_control_settings.cc
index cb6e0de..0f19b78 100644
--- a/rtc_base/experiments/rate_control_settings.cc
+++ b/rtc_base/experiments/rate_control_settings.cc
@@ -121,11 +121,12 @@
ParseHysteresisFactor(key_value_config,
kScreenshareHysteresisFieldTrialname,
kDefaultScreenshareHysteresisFactor)),
- probe_max_allocation_("probe_max_allocation", true) {
+ probe_max_allocation_("probe_max_allocation", true),
+ bitrate_adjuster_("bitrate_adjuster", false) {
ParseFieldTrial(
{&congestion_window_, &congestion_window_pushback_, &pacing_factor_,
&alr_probing_, &trust_vp8_, &trust_vp9_, &video_hysteresis_,
- &screenshare_hysteresis_, &probe_max_allocation_},
+ &screenshare_hysteresis_, &probe_max_allocation_, &bitrate_adjuster_},
key_value_config->Lookup("WebRTC-VideoRateControl"));
}
@@ -206,4 +207,8 @@
return probe_max_allocation_.Get();
}
+bool RateControlSettings::UseEncoderBitrateAdjuster() const {
+ return bitrate_adjuster_.Get();
+}
+
} // namespace webrtc
diff --git a/rtc_base/experiments/rate_control_settings.h b/rtc_base/experiments/rate_control_settings.h
index e7dc868..e40c7aa 100644
--- a/rtc_base/experiments/rate_control_settings.h
+++ b/rtc_base/experiments/rate_control_settings.h
@@ -50,6 +50,7 @@
VideoEncoderConfig::ContentType content_type) const;
bool TriggerProbeOnMaxAllocatedBitrateChange() const;
+ bool UseEncoderBitrateAdjuster() const;
private:
explicit RateControlSettings(
@@ -67,6 +68,7 @@
FieldTrialParameter<double> video_hysteresis_;
FieldTrialParameter<double> screenshare_hysteresis_;
FieldTrialParameter<bool> probe_max_allocation_;
+ FieldTrialParameter<bool> bitrate_adjuster_;
};
} // namespace webrtc
diff --git a/rtc_base/experiments/rate_control_settings_unittest.cc b/rtc_base/experiments/rate_control_settings_unittest.cc
index ae9a192..0d8c376 100644
--- a/rtc_base/experiments/rate_control_settings_unittest.cc
+++ b/rtc_base/experiments/rate_control_settings_unittest.cc
@@ -124,6 +124,20 @@
.TriggerProbeOnMaxAllocatedBitrateChange());
}
+TEST(RateControlSettingsTest, UseEncoderBitrateAdjuster) {
+ // Should be off by default.
+ EXPECT_FALSE(
+ RateControlSettings::ParseFromFieldTrials().UseEncoderBitrateAdjuster());
+
+ {
+ // Can be turned on via field trial.
+ test::ScopedFieldTrials field_trials(
+ "WebRTC-VideoRateControl/bitrate_adjuster:true/");
+ EXPECT_TRUE(RateControlSettings::ParseFromFieldTrials()
+ .UseEncoderBitrateAdjuster());
+ }
+}
+
} // namespace
} // namespace webrtc