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

Unified Diff: media/audio/alsa/alsa_util.cc

Issue 2883313004: Fix off-by-one in ALSA control name determination. (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/alsa/alsa_util.cc
diff --git a/media/audio/alsa/alsa_util.cc b/media/audio/alsa/alsa_util.cc
index 76bdfbf9410480d4c6dfda89caafbb9539b7e1bf..b94cd17bf05e8ef8ace243ea7aeb5360b1d38395 100644
--- a/media/audio/alsa/alsa_util.cc
+++ b/media/audio/alsa/alsa_util.cc
@@ -54,9 +54,9 @@ static std::string DeviceNameToControlName(const std::string& device_name) {
// deviceName: "front:CARD=Intel,DEV=0", controlName: "hw:CARD=Intel".
// deviceName: "default:CARD=Intel", controlName: "CARD=Intel".
size_t pos2 = device_name.find(',');
- control_name = (pos2 == std::string::npos) ?
- device_name.substr(pos1) :
- kMixerPrefix + device_name.substr(pos1, pos2 - pos1);
+ control_name = (pos2 == std::string::npos)
+ ? device_name.substr(pos1 + 1)
+ : kMixerPrefix + device_name.substr(pos1, pos2 - pos1);
}
return control_name;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698