
This is a no-op change because rtc::Optional is an alias to absl::optional This CL generated by running script with parameter 'rtc_base' Then manually fix where Optional was used without rtc prefix (patchset#3) find $@ -type f \( -name \*.h -o -name \*.cc \) \ -exec sed -i 's|rtc::Optional|absl::optional|g' {} \+ \ -exec sed -i 's|rtc::nullopt|absl::nullopt|g' {} \+ \ -exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+ find $@ -type f -name BUILD.gn \ -exec sed -r -i 's|"[\./api]*:optional"|"//third_party/abseil-cpp/absl/types:optional"|' {} \+; git cl format Bug: webrtc:9078 Change-Id: I825f80cc8089747876ba6316d9e7c30e05716974 Reviewed-on: https://webrtc-review.googlesource.com/84585 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23700}
64 lines
2.3 KiB
C++
64 lines
2.3 KiB
C++
/*
|
|
* Copyright 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/congestion_controller_experiment.h"
|
|
|
|
#include <string>
|
|
|
|
#include "system_wrappers/include/field_trial.h"
|
|
|
|
namespace webrtc {
|
|
namespace {
|
|
|
|
const char kControllerExperiment[] = "WebRTC-BweCongestionController";
|
|
} // namespace
|
|
|
|
bool CongestionControllerExperiment::BbrControllerEnabled() {
|
|
std::string trial_string =
|
|
webrtc::field_trial::FindFullName(kControllerExperiment);
|
|
return trial_string.find("Enabled,BBR") == 0;
|
|
}
|
|
|
|
bool CongestionControllerExperiment::InjectedControllerEnabled() {
|
|
std::string trial_string =
|
|
webrtc::field_trial::FindFullName(kControllerExperiment);
|
|
return trial_string.find("Enabled,Injected") == 0;
|
|
}
|
|
|
|
absl::optional<CongestionControllerExperiment::BbrExperimentConfig>
|
|
CongestionControllerExperiment::GetBbrExperimentConfig() {
|
|
if (!BbrControllerEnabled())
|
|
return absl::nullopt;
|
|
std::string trial_string =
|
|
webrtc::field_trial::FindFullName(kControllerExperiment);
|
|
BbrExperimentConfig config;
|
|
if (sscanf(
|
|
trial_string.c_str(),
|
|
"Enabled,BBR,"
|
|
"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,"
|
|
"%lf,%lf,%lf,%lf,%lf,%lf",
|
|
&config.exit_startup_on_loss, &config.exit_startup_rtt_threshold_ms,
|
|
&config.fully_drain_queue, &config.initial_conservation_in_startup,
|
|
&config.num_startup_rtts, &config.probe_rtt_based_on_bdp,
|
|
&config.probe_rtt_disabled_if_app_limited,
|
|
&config.probe_rtt_skipped_if_similar_rtt, &config.rate_based_recovery,
|
|
&config.rate_based_startup, &config.slower_startup,
|
|
&config.encoder_rate_gain, &config.encoder_rate_gain_in_probe_rtt,
|
|
&config.max_ack_height_window_multiplier,
|
|
&config.max_aggregation_bytes_multiplier,
|
|
&config.probe_bw_pacing_gain_offset,
|
|
&config.probe_rtt_congestion_window_gain) == 17) {
|
|
return config;
|
|
} else {
|
|
return absl::nullopt;
|
|
}
|
|
}
|
|
|
|
} // namespace webrtc
|