Replace std::string::find() == 0 with absl::StartsWith.
Bug: None Change-Id: I070c4a5d19455f3a5c5d3ccc05f418545c351987 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172584 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30960}
This commit is contained in:
committed by
Commit Bot
parent
e283d1ca64
commit
57cabed0b0
@ -51,6 +51,7 @@ rtc_library("goog_cc") {
|
||||
"../../../rtc_base/experiments:rate_control_settings",
|
||||
"../../../system_wrappers",
|
||||
"../../remote_bitrate_estimator",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -78,6 +79,7 @@ rtc_library("pushback_controller") {
|
||||
"../../../api/units:data_size",
|
||||
"../../../rtc_base:checks",
|
||||
"../../../rtc_base/experiments:rate_control_settings",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -137,6 +139,7 @@ rtc_library("estimators") {
|
||||
"../../../rtc_base:safe_minmax",
|
||||
"../../../rtc_base/experiments:field_trial_parser",
|
||||
"../../remote_bitrate_estimator",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -162,6 +165,7 @@ rtc_library("loss_based_controller") {
|
||||
"../../../system_wrappers:field_trial",
|
||||
"../../../system_wrappers:metrics",
|
||||
"../../remote_bitrate_estimator",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -187,6 +191,7 @@ rtc_library("delay_based_bwe") {
|
||||
"../../../system_wrappers:metrics",
|
||||
"../../pacing",
|
||||
"../../remote_bitrate_estimator",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
@ -213,6 +218,7 @@ rtc_library("probe_controller") {
|
||||
"../../../rtc_base/experiments:field_trial_parser",
|
||||
"../../../rtc_base/system:unused",
|
||||
"../../../system_wrappers:metrics",
|
||||
"//third_party/abseil-cpp/absl/strings",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/experiments/rate_control_settings.h"
|
||||
|
||||
@ -24,8 +25,9 @@ namespace webrtc {
|
||||
CongestionWindowPushbackController::CongestionWindowPushbackController(
|
||||
const WebRtcKeyValueConfig* key_value_config)
|
||||
: add_pacing_(
|
||||
key_value_config->Lookup("WebRTC-AddPacingToCongestionWindowPushback")
|
||||
.find("Enabled") == 0),
|
||||
absl::StartsWith(key_value_config->Lookup(
|
||||
"WebRTC-AddPacingToCongestionWindowPushback"),
|
||||
"Enabled")),
|
||||
min_pushback_target_bitrate_bps_(
|
||||
RateControlSettings::ParseFromKeyValueConfig(key_value_config)
|
||||
.CongestionWindowMinPushbackTargetBitrateBps()),
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/rtc_event_log/rtc_event.h"
|
||||
#include "api/rtc_event_log/rtc_event_log.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h"
|
||||
@ -113,9 +114,9 @@ DelayBasedBwe::DelayBasedBwe(const WebRtcKeyValueConfig* key_value_config,
|
||||
prev_bitrate_(DataRate::Zero()),
|
||||
has_once_detected_overuse_(false),
|
||||
prev_state_(BandwidthUsage::kBwNormal),
|
||||
alr_limited_backoff_enabled_(
|
||||
key_value_config->Lookup("WebRTC-Bwe-AlrLimitedBackoff")
|
||||
.find("Enabled") == 0) {
|
||||
alr_limited_backoff_enabled_(absl::StartsWith(
|
||||
key_value_config->Lookup("WebRTC-Bwe-AlrLimitedBackoff"),
|
||||
"Enabled")) {
|
||||
RTC_LOG(LS_INFO) << "Initialized DelayBasedBwe with small packet filtering "
|
||||
<< ignore_small_.Parser()->Encode()
|
||||
<< ", separate audio overuse detection"
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_remote_estimate.h"
|
||||
#include "modules/congestion_controller/goog_cc/alr_detector.h"
|
||||
@ -53,11 +54,11 @@ int64_t GetBpsOrDefault(const absl::optional<DataRate>& rate,
|
||||
}
|
||||
|
||||
bool IsEnabled(const WebRtcKeyValueConfig* config, absl::string_view key) {
|
||||
return config->Lookup(key).find("Enabled") == 0;
|
||||
return absl::StartsWith(config->Lookup(key), "Enabled");
|
||||
}
|
||||
|
||||
bool IsNotDisabled(const WebRtcKeyValueConfig* config, absl::string_view key) {
|
||||
return config->Lookup(key).find("Disabled") != 0;
|
||||
return !absl::StartsWith(config->Lookup(key), "Disabled");
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/units/data_rate.h"
|
||||
#include "api/units/time_delta.h"
|
||||
#include "api/units/timestamp.h"
|
||||
@ -129,12 +130,12 @@ ProbeControllerConfig::~ProbeControllerConfig() = default;
|
||||
ProbeController::ProbeController(const WebRtcKeyValueConfig* key_value_config,
|
||||
RtcEventLog* event_log)
|
||||
: enable_periodic_alr_probing_(false),
|
||||
in_rapid_recovery_experiment_(
|
||||
key_value_config->Lookup(kBweRapidRecoveryExperiment)
|
||||
.find("Enabled") == 0),
|
||||
limit_probes_with_allocateable_rate_(
|
||||
key_value_config->Lookup(kCappedProbingFieldTrialName)
|
||||
.find("Disabled") != 0),
|
||||
in_rapid_recovery_experiment_(absl::StartsWith(
|
||||
key_value_config->Lookup(kBweRapidRecoveryExperiment),
|
||||
"Enabled")),
|
||||
limit_probes_with_allocateable_rate_(!absl::StartsWith(
|
||||
key_value_config->Lookup(kCappedProbingFieldTrialName),
|
||||
"Disabled")),
|
||||
event_log_(event_log),
|
||||
config_(ProbeControllerConfig(key_value_config)) {
|
||||
Reset(0);
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "api/rtc_event_log/rtc_event.h"
|
||||
#include "api/rtc_event_log/rtc_event_log.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h"
|
||||
@ -60,7 +61,7 @@ bool BweLossExperimentIsEnabled() {
|
||||
std::string experiment_string =
|
||||
webrtc::field_trial::FindFullName(kBweLosExperiment);
|
||||
// The experiment is enabled iff the field trial string begins with "Enabled".
|
||||
return experiment_string.find("Enabled") == 0;
|
||||
return absl::StartsWith(experiment_string, "Enabled");
|
||||
}
|
||||
|
||||
bool ReadBweLossExperimentParameters(float* low_loss_threshold,
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
#include "modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
||||
@ -115,8 +116,9 @@ constexpr char TrendlineEstimatorSettings::kKey[];
|
||||
|
||||
TrendlineEstimatorSettings::TrendlineEstimatorSettings(
|
||||
const WebRtcKeyValueConfig* key_value_config) {
|
||||
if (key_value_config->Lookup(kBweWindowSizeInPacketsExperiment)
|
||||
.find("Enabled") == 0) {
|
||||
if (absl::StartsWith(
|
||||
key_value_config->Lookup(kBweWindowSizeInPacketsExperiment),
|
||||
"Enabled")) {
|
||||
window_size = ReadTrendlineFilterWindowSize(key_value_config);
|
||||
}
|
||||
Parser()->Parse(key_value_config->Lookup(TrendlineEstimatorSettings::kKey));
|
||||
|
||||
Reference in New Issue
Block a user