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

Unified Diff: content/browser/renderer_host/media/media_stream_manager.cc

Issue 2812903002: Initialize default audio device ID with explicit device ID. (Closed)
Patch Set: fix handling of empty ID in MSM and DCHECKs, use kDefaultDeviceId in unit test Created 3 years, 8 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
Index: content/browser/renderer_host/media/media_stream_manager.cc
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc
index 2711aac7ce99c23aed5401e5a251fea86f556e35..f4d75f0a66f5e11f4afb499029ccdb0b35c74666 100644
--- a/content/browser/renderer_host/media/media_stream_manager.cc
+++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -805,13 +805,18 @@ void MediaStreamManager::StopRemovedDevice(MediaDeviceType type,
.c_str());
}
-bool MediaStreamManager::PickDeviceId(const std::string& salt,
+bool MediaStreamManager::PickDeviceId(MediaStreamType type,
+ const std::string& salt,
const url::Origin& security_origin,
const TrackControls& controls,
const MediaDeviceInfoArray& devices,
std::string* device_id) const {
if (controls.device_id.empty())
return true;
+ if (type == MEDIA_DEVICE_AUDIO_CAPTURE &&
+ media::AudioDeviceDescription::IsDefaultDevice(controls.device_id)) {
+ return true;
+ }
if (!GetDeviceIDFromHMAC(salt, security_origin, controls.device_id, devices,
device_id)) {
@@ -827,10 +832,10 @@ bool MediaStreamManager::GetRequestedDeviceCaptureId(
const MediaDeviceInfoArray& devices,
std::string* device_id) const {
if (type == MEDIA_DEVICE_AUDIO_CAPTURE) {
- return PickDeviceId(request->salt, request->security_origin,
+ return PickDeviceId(type, request->salt, request->security_origin,
request->controls.audio, devices, device_id);
} else if (type == MEDIA_DEVICE_VIDEO_CAPTURE) {
- return PickDeviceId(request->salt, request->security_origin,
+ return PickDeviceId(type, request->salt, request->security_origin,
request->controls.video, devices, device_id);
} else {
NOTREACHED();
« no previous file with comments | « content/browser/renderer_host/media/media_stream_manager.h ('k') | content/renderer/media/user_media_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698