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 <yinwa@google.com>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42268}
diff --git a/modules/congestion_controller/goog_cc/BUILD.gn b/modules/congestion_controller/goog_cc/BUILD.gn
index c6660cb..656ccdb 100644
--- a/modules/congestion_controller/goog_cc/BUILD.gn
+++ b/modules/congestion_controller/goog_cc/BUILD.gn
@@ -209,7 +209,6 @@
"../../../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 43d4837..168e369 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 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 @@
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;