From 8337c966d469339e63a1b71eb95d675656e3e0ef Mon Sep 17 00:00:00 2001 From: Per K Date: Tue, 19 Nov 2024 08:52:53 +0000 Subject: [PATCH] Use default probe duration if target higher than networkstate estimate Use default probe duration and probe delta if probe target higher than network state estimate. Bug: webrtc:42224658, b/379234056 Change-Id: I1e6283681d005111fce5fc90e468b1ce2ce4b81f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/368620 Commit-Queue: Per Kjellander Reviewed-by: Diep Bui Cr-Commit-Position: refs/heads/main@{#43423} --- .../goog_cc/probe_controller.cc | 9 +++++++-- .../goog_cc/probe_controller.h | 7 ++++++- .../goog_cc/probe_controller_unittest.cc | 15 +++++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/modules/congestion_controller/goog_cc/probe_controller.cc b/modules/congestion_controller/goog_cc/probe_controller.cc index b031814774..195c70af89 100644 --- a/modules/congestion_controller/goog_cc/probe_controller.cc +++ b/modules/congestion_controller/goog_cc/probe_controller.cc @@ -106,6 +106,8 @@ ProbeControllerConfig::ProbeControllerConfig( network_state_probe_scale("network_state_scale", 1.0), network_state_probe_duration("network_state_probe_duration", TimeDelta::Millis(15)), + network_state_min_probe_delta("network_state_min_probe_delta", + TimeDelta::Millis(20)), probe_on_max_allocated_bitrate_change("probe_max_allocation", true), first_allocation_probe_scale("alloc_p1", 1), second_allocation_probe_scale("alloc_p2", 2), @@ -135,6 +137,7 @@ ProbeControllerConfig::ProbeControllerConfig( &min_probe_delta, &initial_min_probe_delta, &network_state_estimate_probing_interval, + &network_state_min_probe_delta, &probe_if_estimate_lower_than_network_state_estimate_ratio, &estimate_lower_than_network_state_estimate_probing_interval, &network_state_probe_scale, @@ -529,9 +532,11 @@ ProbeClusterConfig ProbeController::CreateProbeClusterConfig(Timestamp at_time, config.at_time = at_time; config.target_data_rate = bitrate; if (network_estimate_ && - config_.network_state_estimate_probing_interval->IsFinite()) { + config_.network_state_estimate_probing_interval->IsFinite() && + network_estimate_->link_capacity_upper.IsFinite() && + network_estimate_->link_capacity_upper >= bitrate) { config.target_duration = config_.network_state_probe_duration; - config.min_probe_delta = config_.min_probe_delta; + config.min_probe_delta = config_.network_state_min_probe_delta; } else if (at_time < last_allowed_repeated_initial_probe_) { config.target_duration = config_.initial_probe_duration; config.min_probe_delta = config_.initial_min_probe_delta; diff --git a/modules/congestion_controller/goog_cc/probe_controller.h b/modules/congestion_controller/goog_cc/probe_controller.h index a66aa1bfce..61359806cd 100644 --- a/modules/congestion_controller/goog_cc/probe_controller.h +++ b/modules/congestion_controller/goog_cc/probe_controller.h @@ -65,8 +65,13 @@ struct ProbeControllerConfig { estimate_lower_than_network_state_estimate_probing_interval; FieldTrialParameter network_state_probe_scale; // Overrides min_probe_duration if network_state_estimate_probing_interval - // is set and a network state estimate is known. + // is set and a network state estimate is known and equal or higher than the + // probe target. FieldTrialParameter network_state_probe_duration; + // Overrides min_probe_delta if network_state_estimate_probing_interval + // is set and a network state estimate is known and equal or higher than the + // probe target. + FieldTrialParameter network_state_min_probe_delta; // Configures the probes emitted by changed to the allocated bitrate. FieldTrialParameter probe_on_max_allocated_bitrate_change; diff --git a/modules/congestion_controller/goog_cc/probe_controller_unittest.cc b/modules/congestion_controller/goog_cc/probe_controller_unittest.cc index bb3c79c466..76d418d924 100644 --- a/modules/congestion_controller/goog_cc/probe_controller_unittest.cc +++ b/modules/congestion_controller/goog_cc/probe_controller_unittest.cc @@ -1393,7 +1393,8 @@ TEST(ProbeControllerTest, SendsProbeIfNetworkStateEstimateLowerThanMaxProbe) { ProbeControllerFixture fixture( "WebRTC-Bwe-ProbingConfiguration/" "network_state_interval:2s,skip_if_est_larger_than_fraction_of_max:0.9," - "/"); + "network_state_probe_duration:100ms,network_" + "state_min_probe_delta:20/"); std::unique_ptr probe_controller = fixture.CreateController(); ASSERT_THAT( @@ -1420,13 +1421,19 @@ TEST(ProbeControllerTest, SendsProbeIfNetworkStateEstimateLowerThanMaxProbe) { {.link_capacity_upper = 2 * kStartBitrate}); probes = probe_controller->Process(fixture.CurrentTime()); EXPECT_FALSE(probes.empty()); + EXPECT_LE(probes[0].target_data_rate, 2 * kStartBitrate); + // Expect probe durations to be picked from field trial probe target is lower + // or equal to the network state estimate. + EXPECT_EQ(probes[0].min_probe_delta, TimeDelta::Millis(20)); + EXPECT_EQ(probes[0].target_duration, TimeDelta::Millis(100)); } TEST(ProbeControllerTest, ProbeNotLimitedByNetworkStateEsimateIfLowerThantCurrent) { ProbeControllerFixture fixture( "WebRTC-Bwe-ProbingConfiguration/" - "network_state_interval:5s/"); + "network_state_interval:5s,network_state_probe_duration:100ms,network_" + "state_min_probe_delta:20/"); std::unique_ptr probe_controller = fixture.CreateController(); ASSERT_THAT( @@ -1452,6 +1459,10 @@ TEST(ProbeControllerTest, probes = probe_controller->Process(fixture.CurrentTime()); ASSERT_FALSE(probes.empty()); EXPECT_EQ(probes[0].target_data_rate, kStartBitrate); + // Expect probe durations to be default since network state estimate is lower + // than the probe rate. + EXPECT_EQ(probes[0].min_probe_delta, TimeDelta::Millis(2)); + EXPECT_EQ(probes[0].target_duration, TimeDelta::Millis(15)); } TEST(ProbeControllerTest, DontProbeIfDelayIncreased) {