From 377f5a2197fc929fbd379dc7f86584adfebef919 Mon Sep 17 00:00:00 2001 From: Christoffer Rodbro Date: Wed, 12 Feb 2020 10:11:13 +0100 Subject: [PATCH] Add configuration for capping allocation probes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: webrtc:11354 Change-Id: If4d4b6b409da5036e37f288768b43b19531974fc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168440 Reviewed-by: Björn Terelius Commit-Queue: Christoffer Rodbro Cr-Commit-Position: refs/heads/master@{#30506} --- .../goog_cc/probe_controller.cc | 21 ++++++++++++------- .../goog_cc/probe_controller.h | 2 ++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/congestion_controller/goog_cc/probe_controller.cc b/modules/congestion_controller/goog_cc/probe_controller.cc index 321eff2b80..084de184bc 100644 --- a/modules/congestion_controller/goog_cc/probe_controller.cc +++ b/modules/congestion_controller/goog_cc/probe_controller.cc @@ -99,7 +99,8 @@ ProbeControllerConfig::ProbeControllerConfig( alr_probe_scale("alr_scale", 2), first_allocation_probe_scale("alloc_p1", 1), second_allocation_probe_scale("alloc_p2", 2), - allocation_allow_further_probing("alloc_probe_further", false) { + allocation_allow_further_probing("alloc_probe_further", false), + allocation_probe_max("alloc_probe_max", DataRate::PlusInfinity()) { ParseFieldTrial( {&first_exponential_probe_scale, &second_exponential_probe_scale, &further_exponential_probe_scale, &further_probe_threshold, @@ -117,7 +118,7 @@ ProbeControllerConfig::ProbeControllerConfig( key_value_config->Lookup("WebRTC-Bwe-AlrProbing")); ParseFieldTrial( {&first_allocation_probe_scale, &second_allocation_probe_scale, - &allocation_allow_further_probing}, + &allocation_allow_further_probing, &allocation_probe_max}, key_value_config->Lookup("WebRTC-Bwe-AllocationProbing")); } @@ -208,12 +209,18 @@ std::vector ProbeController::OnMaxTotalAllocatedBitrate( if (!config_.first_allocation_probe_scale) return std::vector(); - std::vector probes = { - static_cast(config_.first_allocation_probe_scale.Value() * - max_total_allocated_bitrate)}; + DataRate first_probe_rate = DataRate::bps(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); + std::vector probes = {first_probe_rate.bps()}; if (config_.second_allocation_probe_scale) { - probes.push_back(config_.second_allocation_probe_scale.Value() * - max_total_allocated_bitrate); + DataRate second_probe_rate = + DataRate::bps(max_total_allocated_bitrate) * + config_.second_allocation_probe_scale.Value(); + second_probe_rate = std::min(second_probe_rate, probe_cap); + if (second_probe_rate > first_probe_rate) + probes.push_back(second_probe_rate.bps()); } return InitiateProbing(at_time_ms, probes, config_.allocation_allow_further_probing); diff --git a/modules/congestion_controller/goog_cc/probe_controller.h b/modules/congestion_controller/goog_cc/probe_controller.h index f22acff25f..11e92b97ae 100644 --- a/modules/congestion_controller/goog_cc/probe_controller.h +++ b/modules/congestion_controller/goog_cc/probe_controller.h @@ -20,6 +20,7 @@ #include "api/rtc_event_log/rtc_event_log.h" #include "api/transport/network_control.h" #include "api/transport/webrtc_key_value_config.h" +#include "api/units/data_rate.h" #include "rtc_base/constructor_magic.h" #include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/system/unused.h" @@ -50,6 +51,7 @@ struct ProbeControllerConfig { FieldTrialOptional first_allocation_probe_scale; FieldTrialOptional second_allocation_probe_scale; FieldTrialFlag allocation_allow_further_probing; + FieldTrialParameter allocation_probe_max; }; // This class controls initiation of probing to estimate initial channel