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

Unified Diff: content/renderer/media/user_media_client_impl.cc

Issue 2263583002: Ensure group ID is different for devices which are not associated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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: content/renderer/media/user_media_client_impl.cc
diff --git a/content/renderer/media/user_media_client_impl.cc b/content/renderer/media/user_media_client_impl.cc
index 126de5e7fe8a2e5b2a1324e42a7a05725ddd78a9..bda19f7a6c3e87554a2b1f3cea2f253b38287e39 100644
--- a/content/renderer/media/user_media_client_impl.cc
+++ b/content/renderer/media/user_media_client_impl.cc
@@ -478,10 +478,15 @@ void UserMediaClientImpl::FinalizeEnumerateDevices(
for (size_t i = 0; i < request->audio_input_devices.size(); ++i) {
const MediaStreamDevice& device = request->audio_input_devices[i].device;
DCHECK_EQ(device.type, MEDIA_DEVICE_AUDIO_CAPTURE);
+
+ // We add an arbitrary character to the device ID in order to avoid the same
+ // group ID for the input and output devices that share the same ID but are
+ // not in the same physical device. This may happen with the default and
+ // communication devices.
std::string group_id = base::UintToString(base::Hash(
- !device.matched_output_device_id.empty() ?
- device.matched_output_device_id :
- device.id));
+ device.matched_output_device_id.empty() ?
+ device.id + "i" :
+ device.matched_output_device_id));
devices[i].initialize(
blink::WebString::fromUTF8(device.id),
blink::WebMediaDeviceInfo::MediaDeviceKindAudioInput,
« 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