From 2cdf840b5392de9a46582b3de334f5644011b693 Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Wed, 8 May 2024 16:56:51 +0200 Subject: [PATCH] Read WebRTC-BweLossExperiment from propagated instead of global field trial Bug: webrtc:42220378 Change-Id: I4ddb0719aabe89997ba4f2e663515c1b227938ad Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/350301 Reviewed-by: Ying Wang Auto-Submit: Danil Chapovalov Commit-Queue: Danil Chapovalov Cr-Commit-Position: refs/heads/main@{#42268} --- .../congestion_controller/goog_cc/BUILD.gn | 1 - .../goog_cc/send_side_bandwidth_estimation.cc | 22 ++++++++----------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/modules/congestion_controller/goog_cc/BUILD.gn b/modules/congestion_controller/goog_cc/BUILD.gn index c6660cb409..656ccdb7b2 100644 --- a/modules/congestion_controller/goog_cc/BUILD.gn +++ b/modules/congestion_controller/goog_cc/BUILD.gn @@ -209,7 +209,6 @@ rtc_library("send_side_bwe") { "../../../rtc_base:checks", "../../../rtc_base:logging", "../../../rtc_base/experiments:field_trial_parser", - "../../../system_wrappers:field_trial", "../../../system_wrappers:metrics", "../../remote_bitrate_estimator", ] diff --git a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc index 43d4837e04..168e3695aa 100644 --- a/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc +++ b/modules/congestion_controller/goog_cc/send_side_bandwidth_estimation.cc @@ -33,7 +33,6 @@ #include "rtc_base/checks.h" #include "rtc_base/experiments/field_trial_parser.h" #include "rtc_base/logging.h" -#include "system_wrappers/include/field_trial.h" #include "system_wrappers/include/metrics.h" namespace webrtc { @@ -67,21 +66,18 @@ const size_t kNumUmaRampupMetrics = const char kBweLosExperiment[] = "WebRTC-BweLossExperiment"; -bool BweLossExperimentIsEnabled() { - std::string experiment_string = - webrtc::field_trial::FindFullName(kBweLosExperiment); - // The experiment is enabled iff the field trial string begins with "Enabled". - return absl::StartsWith(experiment_string, "Enabled"); +bool BweLossExperimentIsEnabled(const FieldTrialsView& field_trials) { + return field_trials.IsEnabled(kBweLosExperiment); } -bool ReadBweLossExperimentParameters(float* low_loss_threshold, +bool ReadBweLossExperimentParameters(const FieldTrialsView& field_trials, + float* low_loss_threshold, float* high_loss_threshold, uint32_t* bitrate_threshold_kbps) { RTC_DCHECK(low_loss_threshold); RTC_DCHECK(high_loss_threshold); RTC_DCHECK(bitrate_threshold_kbps); - std::string experiment_string = - webrtc::field_trial::FindFullName(kBweLosExperiment); + std::string experiment_string = field_trials.Lookup(kBweLosExperiment); int parsed_values = sscanf(experiment_string.c_str(), "Enabled-%f,%f,%u", low_loss_threshold, high_loss_threshold, bitrate_threshold_kbps); @@ -231,11 +227,11 @@ SendSideBandwidthEstimation::SendSideBandwidthEstimation( loss_based_state_(LossBasedState::kDelayBasedEstimate), disable_receiver_limit_caps_only_("Disabled") { RTC_DCHECK(event_log); - if (BweLossExperimentIsEnabled()) { + if (BweLossExperimentIsEnabled(*key_value_config_)) { uint32_t bitrate_threshold_kbps; - if (ReadBweLossExperimentParameters(&low_loss_threshold_, - &high_loss_threshold_, - &bitrate_threshold_kbps)) { + if (ReadBweLossExperimentParameters( + *key_value_config_, &low_loss_threshold_, &high_loss_threshold_, + &bitrate_threshold_kbps)) { RTC_LOG(LS_INFO) << "Enabled BweLossExperiment with parameters " << low_loss_threshold_ << ", " << high_loss_threshold_ << ", " << bitrate_threshold_kbps;