Replace std::string::find() == 0 with absl::StartsWith (part 2).

This CL has been generated using clang-tidy [1] except for changes to
BUILD.gn files.

[1] - https://clang.llvm.org/extra/clang-tidy/checks/abseil-string-find-startswith.html

Bug: None
Change-Id: Ibf75601065a53bde28623b8eef57bec067235640
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172586
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30984}
This commit is contained in:
Mirko Bonadei
2020-04-01 13:43:08 +02:00
committed by Commit Bot
parent 55c991cc81
commit 06d3559b79
19 changed files with 52 additions and 35 deletions

View File

@ -59,6 +59,7 @@ rtc_library("remote_bitrate_estimator") {
"../../system_wrappers",
"../../system_wrappers:field_trial",
"../../system_wrappers:metrics",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -18,6 +18,7 @@
#include <cstdio>
#include <string>
#include "absl/strings/match.h"
#include "api/transport/network_types.h"
#include "api/units/data_rate.h"
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
@ -37,12 +38,12 @@ constexpr char kBweBackOffFactorExperiment[] = "WebRTC-BweBackOffFactor";
bool IsEnabled(const WebRtcKeyValueConfig& field_trials,
absl::string_view key) {
return field_trials.Lookup(key).find("Enabled") == 0;
return absl::StartsWith(field_trials.Lookup(key), "Enabled");
}
bool IsNotDisabled(const WebRtcKeyValueConfig& field_trials,
absl::string_view key) {
return field_trials.Lookup(key).find("Disabled") != 0;
return !absl::StartsWith(field_trials.Lookup(key), "Disabled");
}
double ReadBackoffFactor(const WebRtcKeyValueConfig& key_value_config) {