Add field trial property alloc_current_bwe_limit

The new field trial can be used to ensure probes are limited by the current BWE and does not automatically send a probe at the new max rate.

Also removes unused
  FieldTrialFlag allocation_allow_further_probing;
  FieldTrialParameter<DataRate> allocation_probe_max;



Bug: webrtc:14928
Change-Id: I0d5c350c0231ca0600033ad8211dca0574104201
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/339840
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Diep Bui <diepbp@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41744}
This commit is contained in:
Per K 2024-02-15 11:28:23 +01:00 committed by WebRTC LUCI CQ
parent 6a8236617d
commit 45242adc4c
3 changed files with 58 additions and 12 deletions

View File

@ -105,8 +105,7 @@ ProbeControllerConfig::ProbeControllerConfig(
probe_on_max_allocated_bitrate_change("probe_max_allocation", true),
first_allocation_probe_scale("alloc_p1", 1),
second_allocation_probe_scale("alloc_p2", 2),
allocation_allow_further_probing("alloc_probe_further", false),
allocation_probe_max("alloc_probe_max", DataRate::PlusInfinity()),
allocation_probe_limit_by_current_scale("alloc_current_bwe_limit"),
min_probe_packets_sent("min_probe_packets_sent", 5),
min_probe_duration("min_probe_duration", TimeDelta::Millis(15)),
loss_limited_probe_scale("loss_limited_scale", 1.5),
@ -118,7 +117,7 @@ ProbeControllerConfig::ProbeControllerConfig(
&further_exponential_probe_scale, &further_probe_threshold,
&alr_probing_interval, &alr_probe_scale,
&probe_on_max_allocated_bitrate_change, &first_allocation_probe_scale,
&second_allocation_probe_scale, &allocation_allow_further_probing,
&second_allocation_probe_scale, &allocation_probe_limit_by_current_scale,
&min_probe_duration, &network_state_estimate_probing_interval,
&probe_if_estimate_lower_than_network_state_estimate_ratio,
&estimate_lower_than_network_state_estimate_probing_interval,
@ -138,7 +137,7 @@ ProbeControllerConfig::ProbeControllerConfig(
key_value_config->Lookup("WebRTC-Bwe-AlrProbing"));
ParseFieldTrial(
{&first_allocation_probe_scale, &second_allocation_probe_scale,
&allocation_allow_further_probing, &allocation_probe_max},
&allocation_probe_limit_by_current_scale},
key_value_config->Lookup("WebRTC-Bwe-AllocationProbing"));
ParseFieldTrial({&min_probe_packets_sent, &min_probe_duration},
key_value_config->Lookup("WebRTC-Bwe-ProbingBehavior"));
@ -220,19 +219,31 @@ std::vector<ProbeClusterConfig> ProbeController::OnMaxTotalAllocatedBitrate(
DataRate first_probe_rate = max_total_allocated_bitrate *
config_.first_allocation_probe_scale.Value();
DataRate probe_cap = config_.allocation_probe_max.Get();
first_probe_rate = std::min(first_probe_rate, probe_cap);
DataRate current_bwe_limit =
!config_.allocation_probe_limit_by_current_scale
? DataRate::PlusInfinity()
: estimated_bitrate_ *
config_.allocation_probe_limit_by_current_scale.Value();
bool limited_by_current_bwe = current_bwe_limit < first_probe_rate;
if (limited_by_current_bwe) {
first_probe_rate = current_bwe_limit;
}
std::vector<DataRate> probes = {first_probe_rate};
if (config_.second_allocation_probe_scale) {
if (!limited_by_current_bwe && config_.second_allocation_probe_scale) {
DataRate second_probe_rate =
max_total_allocated_bitrate *
config_.second_allocation_probe_scale.Value();
second_probe_rate = std::min(second_probe_rate, probe_cap);
limited_by_current_bwe = current_bwe_limit < second_probe_rate;
if (limited_by_current_bwe) {
second_probe_rate = current_bwe_limit;
}
if (second_probe_rate > first_probe_rate)
probes.push_back(second_probe_rate);
}
return InitiateProbing(at_time, probes,
config_.allocation_allow_further_probing.Get());
bool allow_further_probing = limited_by_current_bwe;
return InitiateProbing(at_time, probes, allow_further_probing);
}
max_total_allocated_bitrate_ = max_total_allocated_bitrate;
return std::vector<ProbeClusterConfig>();

View File

@ -64,8 +64,7 @@ struct ProbeControllerConfig {
FieldTrialParameter<bool> probe_on_max_allocated_bitrate_change;
FieldTrialOptional<double> first_allocation_probe_scale;
FieldTrialOptional<double> second_allocation_probe_scale;
FieldTrialFlag allocation_allow_further_probing;
FieldTrialParameter<DataRate> allocation_probe_max;
FieldTrialOptional<double> allocation_probe_limit_by_current_scale;
// The minimum number probing packets used.
FieldTrialParameter<int> min_probe_packets_sent;

View File

@ -213,6 +213,42 @@ TEST(ProbeControllerTest, ProbesOnMaxAllocatedBitrateIncreaseOnlyWhenInAlr) {
EXPECT_TRUE(probes.empty());
}
TEST(ProbeControllerTest, ProbesOnMaxAllocatedBitrateLimitedByCurrentBwe) {
ProbeControllerFixture fixture(
"WebRTC-Bwe-ProbingConfiguration/"
"alloc_current_bwe_limit:1.5/");
ASSERT_TRUE(kMaxBitrate > 1.5 * kStartBitrate);
std::unique_ptr<ProbeController> probe_controller =
fixture.CreateController();
ASSERT_THAT(
probe_controller->OnNetworkAvailability({.network_available = true}),
IsEmpty());
auto probes = probe_controller->SetBitrates(
kMinBitrate, kStartBitrate, kMaxBitrate, fixture.CurrentTime());
probes = probe_controller->SetEstimatedBitrate(
kStartBitrate, BandwidthLimitedCause::kDelayBasedLimited,
fixture.CurrentTime());
// Wait long enough to time out exponential probing.
fixture.AdvanceTime(kExponentialProbingTimeout);
probes = probe_controller->Process(fixture.CurrentTime());
EXPECT_TRUE(probes.empty());
// Probe when in alr.
probe_controller->SetAlrStartTimeMs(fixture.CurrentTime().ms());
probes = probe_controller->OnMaxTotalAllocatedBitrate(kMaxBitrate,
fixture.CurrentTime());
EXPECT_EQ(probes.size(), 1u);
EXPECT_EQ(probes.at(0).target_data_rate, 1.5 * kStartBitrate);
// Continue probing if probe succeeds.
probes = probe_controller->SetEstimatedBitrate(
1.5 * kStartBitrate, BandwidthLimitedCause::kDelayBasedLimited,
fixture.CurrentTime());
EXPECT_EQ(probes.size(), 1u);
EXPECT_GT(probes.at(0).target_data_rate, 1.5 * kStartBitrate);
}
TEST(ProbeControllerTest, CanDisableProbingOnMaxTotalAllocatedBitrateIncrease) {
ProbeControllerFixture fixture(
"WebRTC-Bwe-ProbingConfiguration/"