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}
This commit is contained in:
Danil Chapovalov 2024-05-08 16:56:51 +02:00 committed by WebRTC LUCI CQ
parent dbdf36c437
commit 2cdf840b53
2 changed files with 9 additions and 14 deletions

View file

@ -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",
]

View file

@ -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;