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

Unified Diff: content/browser/media/media_devices_util.cc

Issue 2707033003: Fall back to default media device from preferences if no default is supplied from the command line. (Closed)
Patch Set: comment Created 3 years, 10 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/browser/media/media_devices_util.cc
diff --git a/content/browser/media/media_devices_util.cc b/content/browser/media/media_devices_util.cc
index f8320a46fd34be15d1fd8ece6a373c18136972e7..722798c5644f8586bc4bfc71753754ebcccbde97 100644
--- a/content/browser/media/media_devices_util.cc
+++ b/content/browser/media/media_devices_util.cc
@@ -49,7 +49,8 @@ std::string GetDefaultMediaDeviceIDOnUIThread(MediaDeviceType device_type,
return delegate->GetDefaultMediaDeviceID(media_stream_type);
}
-// This function is intended for testing purposes.
+// This function is intended for testing purposes. It returns an empty string
+// if no default device is supplied via the command line.
std::string GetDefaultMediaDeviceIDFromCommandLine(
MediaDeviceType device_type) {
DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
@@ -94,8 +95,12 @@ void GetDefaultMediaDeviceID(
const base::Callback<void(const std::string&)>& callback) {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kUseFakeDeviceForMediaStream)) {
- callback.Run(GetDefaultMediaDeviceIDFromCommandLine(device_type));
- return;
+ std::string command_line_default_device_id =
+ GetDefaultMediaDeviceIDFromCommandLine(device_type);
+ if (!command_line_default_device_id.empty()) {
+ callback.Run(command_line_default_device_id);
+ return;
+ }
}
BrowserThread::PostTaskAndReplyWithResult(
« 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