Add field trial to LossbasedBwe2 to use padding when increasing BWE

UsePadding - signals to GoogCC that padding should be used to fill up to
BWE while BWE is ramping up.

Bug: webrtc:12707
Change-Id: I7b4922dff3a83da370c50c567050bfa748190b40
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324160
Reviewed-by: Diep Bui <diepbp@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40979}
This commit is contained in:
Per K 2023-10-20 15:23:41 +02:00 committed by WebRTC LUCI CQ
parent 1b573a7866
commit adeda8214c
3 changed files with 36 additions and 3 deletions

View File

@ -323,7 +323,9 @@ void LossBasedBweV2::UpdateResult() {
/*new_estimate=*/bounded_bandwidth_estimate) &&
bounded_bandwidth_estimate < delay_based_estimate_ &&
bounded_bandwidth_estimate < max_bitrate_) {
loss_based_result_.state = LossBasedState::kIncreasing;
loss_based_result_.state = config_->use_padding_for_increase
? LossBasedState::kIncreaseUsingPadding
: LossBasedState::kIncreasing;
} else if (bounded_bandwidth_estimate < delay_based_estimate_ &&
bounded_bandwidth_estimate < max_bitrate_) {
loss_based_result_.state = LossBasedState::kDecreasing;
@ -337,7 +339,9 @@ bool LossBasedBweV2::IsEstimateIncreasingWhenLossLimited(
DataRate old_estimate, DataRate new_estimate) {
return (old_estimate < new_estimate ||
(old_estimate == new_estimate &&
loss_based_result_.state == LossBasedState::kIncreasing)) &&
(loss_based_result_.state == LossBasedState::kIncreasing ||
loss_based_result_.state ==
LossBasedState::kIncreaseUsingPadding))) &&
IsInLossLimitedState();
}
@ -409,6 +413,8 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
FieldTrialParameter<int> min_num_observations("MinNumObservations", 3);
FieldTrialParameter<double> lower_bound_by_acked_rate_factor(
"LowerBoundByAckedRateFactor", 0.0);
FieldTrialParameter<bool> use_padding_for_increase("UsePadding", false);
if (key_value_config) {
ParseFieldTrial({&enabled,
&bandwidth_rampup_upper_bound_factor,
@ -444,7 +450,8 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
&not_use_acked_rate_in_alr,
&use_in_start_phase,
&min_num_observations,
&lower_bound_by_acked_rate_factor},
&lower_bound_by_acked_rate_factor,
&use_padding_for_increase},
key_value_config->Lookup("WebRTC-Bwe-LossBasedBweV2"));
}
@ -504,6 +511,7 @@ absl::optional<LossBasedBweV2::Config> LossBasedBweV2::CreateConfig(
config->min_num_observations = min_num_observations.Get();
config->lower_bound_by_acked_rate_factor =
lower_bound_by_acked_rate_factor.Get();
config->use_padding_for_increase = use_padding_for_increase.Get();
return config;
}

View File

@ -117,6 +117,7 @@ class LossBasedBweV2 {
bool use_in_start_phase = false;
int min_num_observations = 0;
double lower_bound_by_acked_rate_factor = 0.0;
bool use_padding_for_increase = false;
};
struct Derivatives {

View File

@ -1435,5 +1435,29 @@ TEST_F(LossBasedBweV2Test, HasDelayBasedStateIfLossBasedBweIsMax) {
DataRate::KilobitsPerSec(1000));
}
TEST_F(LossBasedBweV2Test, IncreaseUsingPaddingStateIfFieldTrial) {
ExplicitKeyValueConfig key_value_config(
ShortObservationConfig("UsePadding:true"));
LossBasedBweV2 loss_based_bandwidth_estimator(&key_value_config);
loss_based_bandwidth_estimator.SetBandwidthEstimate(
DataRate::KilobitsPerSec(2500));
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
CreatePacketResultsWith50pLossRate(
/*first_packet_timestamp=*/Timestamp::Zero()),
/*delay_based_estimate=*/DataRate::PlusInfinity(),
/*in_alr=*/false);
ASSERT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kDecreasing);
loss_based_bandwidth_estimator.UpdateBandwidthEstimate(
CreatePacketResultsWithReceivedPackets(
/*first_packet_timestamp=*/Timestamp::Zero() +
kObservationDurationLowerBound),
/*delay_based_estimate=*/DataRate::PlusInfinity(),
/*in_alr=*/false);
EXPECT_EQ(loss_based_bandwidth_estimator.GetLossBasedResult().state,
LossBasedState::kIncreaseUsingPadding);
}
} // namespace
} // namespace webrtc