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

Side by Side Diff: media/audio/mac/audio_manager_mac.cc

Issue 11878032: Plumb |input_channels| all the way to AudioManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « media/audio/audio_parameters.cc ('k') | media/audio/win/audio_manager_win.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 "media/audio/mac/audio_manager_mac.h" 5 #include "media/audio/mac/audio_manager_mac.h"
6 6
7 #include <CoreAudio/AudioHardware.h> 7 #include <CoreAudio/AudioHardware.h>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 AudioOutputStream* AudioManagerMac::MakeLinearOutputStream( 276 AudioOutputStream* AudioManagerMac::MakeLinearOutputStream(
277 const AudioParameters& params) { 277 const AudioParameters& params) {
278 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); 278 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
279 return new PCMQueueOutAudioOutputStream(this, params); 279 return new PCMQueueOutAudioOutputStream(this, params);
280 } 280 }
281 281
282 AudioOutputStream* AudioManagerMac::MakeLowLatencyOutputStream( 282 AudioOutputStream* AudioManagerMac::MakeLowLatencyOutputStream(
283 const AudioParameters& params) { 283 const AudioParameters& params) {
284 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); 284 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
285 285
286 // TODO(crogers): remove once we properly handle input device selection. 286 // TODO(crogers): support more than stereo input.
287 // TODO(crogers): remove flag once we handle input device selection.
287 // https://code.google.com/p/chromium/issues/detail?id=147327 288 // https://code.google.com/p/chromium/issues/detail?id=147327
288 if (CommandLine::ForCurrentProcess()->HasSwitch( 289 if (params.input_channels() == 2 &&
289 switches::kEnableWebAudioInput)) { 290 CommandLine::ForCurrentProcess()->HasSwitch(
291 switches::kEnableWebAudioInput)) {
290 if (HasUnifiedDefaultIO()) 292 if (HasUnifiedDefaultIO())
291 return new AudioHardwareUnifiedStream(this, params); 293 return new AudioHardwareUnifiedStream(this, params);
292 294
293 // kAudioDeviceUnknown translates to "use default" here. 295 // kAudioDeviceUnknown translates to "use default" here.
294 return new AudioSynchronizedStream(this, 296 return new AudioSynchronizedStream(this,
295 params, 297 params,
296 kAudioDeviceUnknown, 298 kAudioDeviceUnknown,
297 kAudioDeviceUnknown); 299 kAudioDeviceUnknown);
298 } 300 }
299 301
(...skipping 21 matching lines...) Expand all
321 323
322 AudioParameters AudioManagerMac::GetPreferredLowLatencyOutputStreamParameters( 324 AudioParameters AudioManagerMac::GetPreferredLowLatencyOutputStreamParameters(
323 const AudioParameters& input_params) { 325 const AudioParameters& input_params) {
324 if (CommandLine::ForCurrentProcess()->HasSwitch( 326 if (CommandLine::ForCurrentProcess()->HasSwitch(
325 switches::kEnableWebAudioInput)) { 327 switches::kEnableWebAudioInput)) {
326 // TODO(crogers): given the limitations of the AudioOutputStream 328 // TODO(crogers): given the limitations of the AudioOutputStream
327 // back-ends used with kEnableWebAudioInput, we hard-code to stereo. 329 // back-ends used with kEnableWebAudioInput, we hard-code to stereo.
328 // Specifically, this is a limitation of AudioSynchronizedStream which 330 // Specifically, this is a limitation of AudioSynchronizedStream which
329 // can be removed as part of the work to consolidate these back-ends. 331 // can be removed as part of the work to consolidate these back-ends.
330 return AudioParameters( 332 return AudioParameters(
331 AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO, 333 AudioParameters::AUDIO_PCM_LOW_LATENCY,
334 CHANNEL_LAYOUT_STEREO, input_params.input_channels(),
332 GetAudioHardwareSampleRate(), 16, GetAudioHardwareBufferSize()); 335 GetAudioHardwareSampleRate(), 16, GetAudioHardwareBufferSize());
333 } 336 }
334 337
335 return AudioManagerBase::GetPreferredLowLatencyOutputStreamParameters( 338 return AudioManagerBase::GetPreferredLowLatencyOutputStreamParameters(
336 input_params); 339 input_params);
337 } 340 }
338 341
339 void AudioManagerMac::CreateDeviceListener() { 342 void AudioManagerMac::CreateDeviceListener() {
340 DCHECK(GetMessageLoop()->BelongsToCurrentThread()); 343 DCHECK(GetMessageLoop()->BelongsToCurrentThread());
341 output_device_listener_.reset(new AudioDeviceListenerMac(base::Bind( 344 output_device_listener_.reset(new AudioDeviceListenerMac(base::Bind(
(...skipping 12 matching lines...) Expand all
354 GetMessageLoop()->PostDelayedTask(FROM_HERE, base::Bind( 357 GetMessageLoop()->PostDelayedTask(FROM_HERE, base::Bind(
355 &AudioManagerMac::NotifyAllOutputDeviceChangeListeners, 358 &AudioManagerMac::NotifyAllOutputDeviceChangeListeners,
356 base::Unretained(this)), base::TimeDelta::FromSeconds(2)); 359 base::Unretained(this)), base::TimeDelta::FromSeconds(2));
357 } 360 }
358 361
359 AudioManager* CreateAudioManager() { 362 AudioManager* CreateAudioManager() {
360 return new AudioManagerMac(); 363 return new AudioManagerMac();
361 } 364 }
362 365
363 } // namespace media 366 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_parameters.cc ('k') | media/audio/win/audio_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698