Moved ALR experiment settings to new experiments folder.
This replaces most of the existing dependencies on the application limited region(ALR) detector. This is to achieve a greater separation of concerns and will make further refactoring regarding the ALR Detector less invasive on other parts of the code base. Bug: webrtc:8415 Change-Id: I92912254c6d02285cce6a88f6789f0ac94794c88 Reviewed-on: https://webrtc-review.googlesource.com/37560 Commit-Queue: Sebastian Jansson <srte@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Philip Eliasson <philipel@webrtc.org> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21598}
This commit is contained in:
committed by
Commit Bot
parent
0a52f1def6
commit
cabe3838bb
21
rtc_base/experiments/BUILD.gn
Normal file
21
rtc_base/experiments/BUILD.gn
Normal file
@ -0,0 +1,21 @@
|
||||
# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license
|
||||
# that can be found in the LICENSE file in the root of the source
|
||||
# tree. An additional intellectual property rights grant can be found
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
import("../../webrtc.gni")
|
||||
|
||||
rtc_static_library("alr_experiment") {
|
||||
sources = [
|
||||
"alr_experiment.cc",
|
||||
"alr_experiment.h",
|
||||
]
|
||||
deps = [
|
||||
"../:rtc_base_approved",
|
||||
"../../api:optional",
|
||||
"../../system_wrappers:field_trial_api",
|
||||
]
|
||||
}
|
||||
3
rtc_base/experiments/DEPS
Normal file
3
rtc_base/experiments/DEPS
Normal file
@ -0,0 +1,3 @@
|
||||
include_rules = [
|
||||
"+system_wrappers",
|
||||
]
|
||||
83
rtc_base/experiments/alr_experiment.cc
Normal file
83
rtc_base/experiments/alr_experiment.cc
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "rtc_base/experiments/alr_experiment.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "rtc_base/format_macros.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
const char AlrExperimentSettings::kScreenshareProbingBweExperimentName[] =
|
||||
"WebRTC-ProbingScreenshareBwe";
|
||||
const char AlrExperimentSettings::kStrictPacingAndProbingExperimentName[] =
|
||||
"WebRTC-StrictPacingAndProbing";
|
||||
const char kDefaultProbingScreenshareBweSettings[] = "1.0,2875,80,40,-60,3";
|
||||
|
||||
bool AlrExperimentSettings::MaxOneFieldTrialEnabled() {
|
||||
return field_trial::FindFullName(kStrictPacingAndProbingExperimentName)
|
||||
.empty() ||
|
||||
field_trial::FindFullName(kScreenshareProbingBweExperimentName)
|
||||
.empty();
|
||||
}
|
||||
|
||||
rtc::Optional<AlrExperimentSettings>
|
||||
AlrExperimentSettings::CreateFromFieldTrial(const char* experiment_name) {
|
||||
rtc::Optional<AlrExperimentSettings> ret;
|
||||
std::string group_name = field_trial::FindFullName(experiment_name);
|
||||
|
||||
const std::string kIgnoredSuffix = "_Dogfood";
|
||||
std::string::size_type suffix_pos = group_name.rfind(kIgnoredSuffix);
|
||||
if (suffix_pos != std::string::npos &&
|
||||
suffix_pos == group_name.length() - kIgnoredSuffix.length()) {
|
||||
group_name.resize(group_name.length() - kIgnoredSuffix.length());
|
||||
}
|
||||
|
||||
if (experiment_name == kScreenshareProbingBweExperimentName) {
|
||||
// This experiment is now default-on with fixed settings.
|
||||
// TODO(sprang): Remove this kill-switch and clean up experiment code.
|
||||
if (group_name != "Disabled") {
|
||||
group_name = kDefaultProbingScreenshareBweSettings;
|
||||
}
|
||||
}
|
||||
|
||||
if (group_name.empty())
|
||||
return ret;
|
||||
|
||||
AlrExperimentSettings settings;
|
||||
if (sscanf(group_name.c_str(), "%f,%" PRId64 ",%d,%d,%d,%d",
|
||||
&settings.pacing_factor, &settings.max_paced_queue_time,
|
||||
&settings.alr_bandwidth_usage_percent,
|
||||
&settings.alr_start_budget_level_percent,
|
||||
&settings.alr_stop_budget_level_percent,
|
||||
&settings.group_id) == 6) {
|
||||
ret.emplace(settings);
|
||||
RTC_LOG(LS_INFO) << "Using ALR experiment settings: "
|
||||
"pacing factor: "
|
||||
<< settings.pacing_factor << ", max pacer queue length: "
|
||||
<< settings.max_paced_queue_time
|
||||
<< ", ALR start bandwidth usage percent: "
|
||||
<< settings.alr_bandwidth_usage_percent
|
||||
<< ", ALR end budget level percent: "
|
||||
<< settings.alr_start_budget_level_percent
|
||||
<< ", ALR end budget level percent: "
|
||||
<< settings.alr_stop_budget_level_percent
|
||||
<< ", ALR experiment group ID: " << settings.group_id;
|
||||
} else {
|
||||
RTC_LOG(LS_INFO) << "Failed to parse ALR experiment: " << experiment_name;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
40
rtc_base/experiments/alr_experiment.h
Normal file
40
rtc_base/experiments/alr_experiment.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef RTC_BASE_EXPERIMENTS_ALR_EXPERIMENT_H_
|
||||
#define RTC_BASE_EXPERIMENTS_ALR_EXPERIMENT_H_
|
||||
|
||||
#include "api/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
struct AlrExperimentSettings {
|
||||
public:
|
||||
float pacing_factor;
|
||||
int64_t max_paced_queue_time;
|
||||
int alr_bandwidth_usage_percent;
|
||||
int alr_start_budget_level_percent;
|
||||
int alr_stop_budget_level_percent;
|
||||
// Will be sent to the receive side for stats slicing.
|
||||
// Can be 0..6, because it's sent as a 3 bits value and there's also
|
||||
// reserved value to indicate absence of experiment.
|
||||
int group_id;
|
||||
|
||||
static const char kScreenshareProbingBweExperimentName[];
|
||||
static const char kStrictPacingAndProbingExperimentName[];
|
||||
static rtc::Optional<AlrExperimentSettings> CreateFromFieldTrial(
|
||||
const char* experiment_name);
|
||||
static bool MaxOneFieldTrialEnabled();
|
||||
|
||||
private:
|
||||
AlrExperimentSettings() = default;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // RTC_BASE_EXPERIMENTS_ALR_EXPERIMENT_H_
|
||||
Reference in New Issue
Block a user