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

Side by Side Diff: content/browser/media/media_devices_util.cc

Issue 2713653002: Revert of Fall back to default media device from preferences if no default is supplied from the command line. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/media/media_devices_util.h" 5 #include "content/browser/media/media_devices_util.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 case MEDIA_DEVICE_TYPE_VIDEO_INPUT: 42 case MEDIA_DEVICE_TYPE_VIDEO_INPUT:
43 media_stream_type = MEDIA_DEVICE_VIDEO_CAPTURE; 43 media_stream_type = MEDIA_DEVICE_VIDEO_CAPTURE;
44 break; 44 break;
45 default: 45 default:
46 return std::string(); 46 return std::string();
47 } 47 }
48 48
49 return delegate->GetDefaultMediaDeviceID(media_stream_type); 49 return delegate->GetDefaultMediaDeviceID(media_stream_type);
50 } 50 }
51 51
52 // This function is intended for testing purposes. It returns an empty string 52 // This function is intended for testing purposes.
53 // if no default device is supplied via the command line.
54 std::string GetDefaultMediaDeviceIDFromCommandLine( 53 std::string GetDefaultMediaDeviceIDFromCommandLine(
55 MediaDeviceType device_type) { 54 MediaDeviceType device_type) {
56 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 55 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
57 switches::kUseFakeDeviceForMediaStream)); 56 switches::kUseFakeDeviceForMediaStream));
58 const std::string option = 57 const std::string option =
59 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 58 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
60 switches::kUseFakeDeviceForMediaStream); 59 switches::kUseFakeDeviceForMediaStream);
61 // Optional comma delimited parameters to the command line can specify values 60 // Optional comma delimited parameters to the command line can specify values
62 // for the default device IDs. 61 // for the default device IDs.
63 // Examples: "video-input-default-id=mycam, audio-input-default-id=mymic" 62 // Examples: "video-input-default-id=mycam, audio-input-default-id=mymic"
(...skipping 24 matching lines...) Expand all
88 87
89 } // namespace 88 } // namespace
90 89
91 void GetDefaultMediaDeviceID( 90 void GetDefaultMediaDeviceID(
92 MediaDeviceType device_type, 91 MediaDeviceType device_type,
93 int render_process_id, 92 int render_process_id,
94 int render_frame_id, 93 int render_frame_id,
95 const base::Callback<void(const std::string&)>& callback) { 94 const base::Callback<void(const std::string&)>& callback) {
96 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 95 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
97 switches::kUseFakeDeviceForMediaStream)) { 96 switches::kUseFakeDeviceForMediaStream)) {
98 std::string command_line_default_device_id = 97 callback.Run(GetDefaultMediaDeviceIDFromCommandLine(device_type));
99 GetDefaultMediaDeviceIDFromCommandLine(device_type); 98 return;
100 if (!command_line_default_device_id.empty()) {
101 callback.Run(command_line_default_device_id);
102 return;
103 }
104 } 99 }
105 100
106 BrowserThread::PostTaskAndReplyWithResult( 101 BrowserThread::PostTaskAndReplyWithResult(
107 BrowserThread::UI, FROM_HERE, 102 BrowserThread::UI, FROM_HERE,
108 base::Bind(&GetDefaultMediaDeviceIDOnUIThread, device_type, 103 base::Bind(&GetDefaultMediaDeviceIDOnUIThread, device_type,
109 render_process_id, render_frame_id), 104 render_process_id, render_frame_id),
110 callback); 105 callback);
111 } 106 }
112 107
113 } // namespace content 108 } // namespace content
OLDNEW
« 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