Allow setting a different rampup factor if BWE < hold rate

Bug: webrtc:12707
Change-Id: Id674246d66d1b7f2a705934350e8a4f93564639f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/329120
Reviewed-by: Diep Bui <diepbp@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41273}
This commit is contained in:
Per K 2023-11-29 11:56:53 +01:00 committed by WebRTC LUCI CQ
parent 49c35d377b
commit 2e3152654a
2 changed files with 32 additions and 2 deletions

View File

@ -293,11 +293,17 @@ void LossBasedBweV2::UpdateBandwidthEstimate(
/*new_estimate=*/best_candidate.loss_limited_bandwidth);
// Bound the best candidate by the acked bitrate.
if (increasing_when_loss_limited && IsValid(acknowledged_bitrate_)) {
double rampup_factor = config_->bandwidth_rampup_upper_bound_factor;
if (IsValid(last_hold_info_.rate) &&
acknowledged_bitrate_ <
config_->bandwidth_rampup_hold_threshold * last_hold_info_.rate) {
rampup_factor = config_->bandwidth_rampup_upper_bound_factor_in_hold;
}
best_candidate.loss_limited_bandwidth =
std::max(current_best_estimate_.loss_limited_bandwidth,
std::min(best_candidate.loss_limited_bandwidth,
config_->bandwidth_rampup_upper_bound_factor *
(*acknowledged_bitrate_)));
rampup_factor * (*acknowledged_bitrate_)));
// Increase current estimate by at least 1kbps to make sure that the state
// will be switched to kIncreasing, thus padding is triggered.
if (loss_based_result_.state == LossBasedState::kDecreasing &&
@ -412,6 +418,10 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
FieldTrialParameter<bool> enabled("Enabled", true);
FieldTrialParameter<double> bandwidth_rampup_upper_bound_factor(
"BwRampupUpperBoundFactor", 1000000.0);
FieldTrialParameter<double> bandwidth_rampup_upper_bound_factor_in_hold(
"BwRampupUpperBoundInHoldFactor", 1000000.0);
FieldTrialParameter<double> bandwidth_rampup_hold_threshold(
"BwRampupUpperBoundHoldThreshold", 1.3);
FieldTrialParameter<double> rampup_acceleration_max_factor(
"BwRampupAccelMaxFactor", 0.0);
FieldTrialParameter<TimeDelta> rampup_acceleration_maxout_time(
@ -476,6 +486,8 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
if (key_value_config) {
ParseFieldTrial({&enabled,
&bandwidth_rampup_upper_bound_factor,
&bandwidth_rampup_upper_bound_factor_in_hold,
&bandwidth_rampup_hold_threshold,
&rampup_acceleration_max_factor,
&rampup_acceleration_maxout_time,
&candidate_factors,
@ -520,6 +532,10 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
config.emplace();
config->bandwidth_rampup_upper_bound_factor =
bandwidth_rampup_upper_bound_factor.Get();
config->bandwidth_rampup_upper_bound_factor_in_hold =
bandwidth_rampup_upper_bound_factor_in_hold.Get();
config->bandwidth_rampup_hold_threshold =
bandwidth_rampup_hold_threshold.Get();
config->rampup_acceleration_max_factor = rampup_acceleration_max_factor.Get();
config->rampup_acceleration_maxout_time =
rampup_acceleration_maxout_time.Get();
@ -587,6 +603,18 @@ bool LossBasedBweV2::IsConfigValid() const {
<< config_->bandwidth_rampup_upper_bound_factor;
valid = false;
}
if (config_->bandwidth_rampup_upper_bound_factor_in_hold <= 1.0) {
RTC_LOG(LS_WARNING) << "The bandwidth rampup upper bound factor in hold "
"must be greater than 1: "
<< config_->bandwidth_rampup_upper_bound_factor_in_hold;
valid = false;
}
if (config_->bandwidth_rampup_hold_threshold < 0.0) {
RTC_LOG(LS_WARNING) << "The bandwidth rampup hold threshold must"
"must be non-negative.: "
<< config_->bandwidth_rampup_hold_threshold;
valid = false;
}
if (config_->rampup_acceleration_max_factor < 0.0) {
RTC_LOG(LS_WARNING)
<< "The rampup acceleration max factor must be non-negative.: "

View File

@ -86,6 +86,8 @@ class LossBasedBweV2 {
struct Config {
double bandwidth_rampup_upper_bound_factor = 0.0;
double bandwidth_rampup_upper_bound_factor_in_hold = 0;
double bandwidth_rampup_hold_threshold = 0;
double rampup_acceleration_max_factor = 0.0;
TimeDelta rampup_acceleration_maxout_time = TimeDelta::Zero();
std::vector<double> candidate_factors;