Commit 14744bc1 authored by jyw's avatar jyw Committed by Commit bot

Fix off-by-one in ALSA control name determination.

Previously, given a device_id "plug:foo" alsa_util.cc would try to open
the control named ":foo". It will now open "foo".

This is safe because at this point we know we have already found a ':'
at pos1.

BUG=internal 35197382
TEST=manual
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2883313004
Cr-Commit-Position: refs/heads/master@{#472218}
parent f5ac1cf6
...@@ -54,9 +54,9 @@ static std::string DeviceNameToControlName(const std::string& device_name) { ...@@ -54,9 +54,9 @@ static std::string DeviceNameToControlName(const std::string& device_name) {
// deviceName: "front:CARD=Intel,DEV=0", controlName: "hw:CARD=Intel". // deviceName: "front:CARD=Intel,DEV=0", controlName: "hw:CARD=Intel".
// deviceName: "default:CARD=Intel", controlName: "CARD=Intel". // deviceName: "default:CARD=Intel", controlName: "CARD=Intel".
size_t pos2 = device_name.find(','); size_t pos2 = device_name.find(',');
control_name = (pos2 == std::string::npos) ? control_name = (pos2 == std::string::npos)
device_name.substr(pos1) : ? device_name.substr(pos1 + 1)
kMixerPrefix + device_name.substr(pos1, pos2 - pos1); : kMixerPrefix + device_name.substr(pos1, pos2 - pos1);
} }
return control_name; return control_name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment