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

Side by Side Diff: content/browser/renderer_host/media/audio_input_device_manager.cc

Issue 2323913007: Add constructor taking group ID to MediaStreamDevice and StreamDeviceInfo (Closed)
Patch Set: Fix constructor Created 4 years, 3 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 | content/browser/renderer_host/media/audio_input_device_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/media/audio_input_device_manager.h" 5 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Enumerate the devices on the OS. 170 // Enumerate the devices on the OS.
171 // AudioManager is guaranteed to outlive MediaStreamManager in 171 // AudioManager is guaranteed to outlive MediaStreamManager in
172 // BrowserMainloop. 172 // BrowserMainloop.
173 audio_manager_->GetAudioInputDeviceNames(&device_names); 173 audio_manager_->GetAudioInputDeviceNames(&device_names);
174 } 174 }
175 175
176 std::unique_ptr<StreamDeviceInfoArray> devices(new StreamDeviceInfoArray()); 176 std::unique_ptr<StreamDeviceInfoArray> devices(new StreamDeviceInfoArray());
177 for (media::AudioDeviceNames::iterator it = device_names.begin(); 177 for (media::AudioDeviceNames::iterator it = device_names.begin();
178 it != device_names.end(); ++it) { 178 it != device_names.end(); ++it) {
179 // Add device information to device vector. 179 // Add device information to device vector.
180 devices->push_back(StreamDeviceInfo( 180 devices->emplace_back(stream_type, it->device_name, it->unique_id,
181 stream_type, it->device_name, it->unique_id)); 181 audio_manager_->GetGroupIDInput(it->unique_id));
182 }
183 for (StreamDeviceInfo& device_info : *devices) {
184 device_info.device.group_id =
185 audio_manager_->GetGroupIDInput(device_info.device.id);
186 } 182 }
187 183
188 // Return the device list through the listener by posting a task on 184 // Return the device list through the listener by posting a task on
189 // IO thread since MediaStreamManager handles the callback asynchronously. 185 // IO thread since MediaStreamManager handles the callback asynchronously.
190 BrowserThread::PostTask( 186 BrowserThread::PostTask(
191 BrowserThread::IO, 187 BrowserThread::IO,
192 FROM_HERE, 188 FROM_HERE,
193 base::Bind(&AudioInputDeviceManager::DevicesEnumeratedOnIOThread, 189 base::Bind(&AudioInputDeviceManager::DevicesEnumeratedOnIOThread,
194 this, stream_type, base::Passed(&devices))); 190 this, stream_type, base::Passed(&devices)));
195 } 191 }
196 192
197 void AudioInputDeviceManager::OpenOnDeviceThread( 193 void AudioInputDeviceManager::OpenOnDeviceThread(
198 int session_id, const StreamDeviceInfo& info) { 194 int session_id, const StreamDeviceInfo& info) {
199 SCOPED_UMA_HISTOGRAM_TIMER( 195 SCOPED_UMA_HISTOGRAM_TIMER(
200 "Media.AudioInputDeviceManager.OpenOnDeviceThreadTime"); 196 "Media.AudioInputDeviceManager.OpenOnDeviceThreadTime");
201 DCHECK(IsOnDeviceThread()); 197 DCHECK(IsOnDeviceThread());
202 198
203 StreamDeviceInfo out(info.device.type, info.device.name, info.device.id, 199 StreamDeviceInfo out(info.device.type, info.device.name, info.device.id,
204 0, 0, 0); 200 info.device.group_id, 0, 0, 0);
205 out.session_id = session_id; 201 out.session_id = session_id;
206 202
207 MediaStreamDevice::AudioDeviceParameters& input_params = out.device.input; 203 MediaStreamDevice::AudioDeviceParameters& input_params = out.device.input;
208 204
209 if (use_fake_device_) { 205 if (use_fake_device_) {
210 // Don't need to query the hardware information if using fake device. 206 // Don't need to query the hardware information if using fake device.
211 input_params.sample_rate = 44100; 207 input_params.sample_rate = 44100;
212 input_params.channel_layout = media::CHANNEL_LAYOUT_STEREO; 208 input_params.channel_layout = media::CHANNEL_LAYOUT_STEREO;
213 } else { 209 } else {
214 // Get the preferred sample rate and channel configuration for the 210 // Get the preferred sample rate and channel configuration for the
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 #if defined(OS_CHROMEOS) 300 #if defined(OS_CHROMEOS)
305 void AudioInputDeviceManager::SetKeyboardMicStreamActiveOnUIThread( 301 void AudioInputDeviceManager::SetKeyboardMicStreamActiveOnUIThread(
306 bool active) { 302 bool active) {
307 DCHECK_CURRENTLY_ON(BrowserThread::UI); 303 DCHECK_CURRENTLY_ON(BrowserThread::UI);
308 chromeos::CrasAudioHandler::Get()->SetKeyboardMicActive(active); 304 chromeos::CrasAudioHandler::Get()->SetKeyboardMicActive(active);
309 } 305 }
310 #endif 306 #endif
311 307
312 308
313 } // namespace content 309 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/audio_input_device_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698