Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Unified Diff: media/cast/sender/external_video_encoder.cc

Issue 2127373006: Use base::StartWith() in more places when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, resolve conflict Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/key_systems.cc ('k') | storage/common/fileapi/file_system_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/sender/external_video_encoder.cc
diff --git a/media/cast/sender/external_video_encoder.cc b/media/cast/sender/external_video_encoder.cc
index 1348f7f674d3a954a5987886d3bc1420c38d3742..396ad38a87d96efa60d10c10a5f97ddc831964b2 100644
--- a/media/cast/sender/external_video_encoder.cc
+++ b/media/cast/sender/external_video_encoder.cc
@@ -18,6 +18,7 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "media/base/bind_to_current_loop.h"
@@ -64,17 +65,19 @@ int GetConfiguredBacklogRedline() {
const std::string& switch_value =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kCastEncoderUtilHeuristic);
- if (switch_value.find(kBacklogSwitchValue) == 0) {
- int redline = kBacklogDefaultRedline;
- if (!base::StringToInt(switch_value.substr(sizeof(kBacklogSwitchValue) - 1),
- &redline)) {
- redline = kBacklogDefaultRedline;
- }
- VLOG(1) << "Using 'backlog' heuristic with a redline of " << redline
- << " to compute encoder utilization.";
- return redline;
+ if (!base::StartsWith(switch_value, kBacklogSwitchValue,
+ base::CompareCase::SENSITIVE)) {
+ return 0;
+ }
+
+ int redline = kBacklogDefaultRedline;
+ if (!base::StringToInt(switch_value.substr(sizeof(kBacklogSwitchValue) - 1),
+ &redline)) {
+ redline = kBacklogDefaultRedline;
}
- return 0;
+ VLOG(1) << "Using 'backlog' heuristic with a redline of " << redline
+ << " to compute encoder utilization.";
+ return redline;
}
} // namespace
« no previous file with comments | « media/base/key_systems.cc ('k') | storage/common/fileapi/file_system_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698