| OLD | NEW |
| 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/audio_io.h" | 5 #include "media/audio/audio_io.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <objbase.h> // This has to be before initguid.h | 8 #include <objbase.h> // This has to be before initguid.h |
| 9 #include <initguid.h> | 9 #include <initguid.h> |
| 10 #include <mmsystem.h> | 10 #include <mmsystem.h> |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 media::NumberOfWaveOutBuffers(), | 294 media::NumberOfWaveOutBuffers(), |
| 295 WAVE_MAPPER); | 295 WAVE_MAPPER); |
| 296 } | 296 } |
| 297 | 297 |
| 298 // Factory for the implementations of AudioOutputStream for | 298 // Factory for the implementations of AudioOutputStream for |
| 299 // AUDIO_PCM_LOW_LATENCY mode. Two implementations should suffice most | 299 // AUDIO_PCM_LOW_LATENCY mode. Two implementations should suffice most |
| 300 // windows user's needs. | 300 // windows user's needs. |
| 301 // - PCMWaveOutAudioOutputStream: Based on the waveOut API. | 301 // - PCMWaveOutAudioOutputStream: Based on the waveOut API. |
| 302 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API. | 302 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API. |
| 303 AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream( | 303 AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream( |
| 304 const AudioParameters& params) { | 304 const AudioParameters& params, const std::string& input_device_id) { |
| 305 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); | 305 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); |
| 306 if (params.channels() > kWinMaxChannels) | 306 if (params.channels() > kWinMaxChannels) |
| 307 return NULL; | 307 return NULL; |
| 308 | 308 |
| 309 if (!CoreAudioUtil::IsSupported()) { | 309 if (!CoreAudioUtil::IsSupported()) { |
| 310 // Fall back to Windows Wave implementation on Windows XP or lower. | 310 // Fall back to Windows Wave implementation on Windows XP or lower. |
| 311 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista."; | 311 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista."; |
| 312 return new PCMWaveOutAudioOutputStream( | 312 return new PCMWaveOutAudioOutputStream( |
| 313 this, params, media::NumberOfWaveOutBuffers(), WAVE_MAPPER); | 313 this, params, media::NumberOfWaveOutBuffers(), WAVE_MAPPER); |
| 314 } | 314 } |
| 315 | 315 |
| 316 // TODO(crogers): support more than stereo input. | 316 // TODO(crogers): support more than stereo input. |
| 317 if (params.input_channels() > 0) { | 317 if (params.input_channels() > 0) { |
| 318 DVLOG(1) << "WASAPIUnifiedStream is created."; | 318 DVLOG(1) << "WASAPIUnifiedStream is created."; |
| 319 return new WASAPIUnifiedStream(this, params); | 319 return new WASAPIUnifiedStream(this, params, input_device_id); |
| 320 } | 320 } |
| 321 | 321 |
| 322 return new WASAPIAudioOutputStream(this, params, eConsole); | 322 return new WASAPIAudioOutputStream(this, params, eConsole); |
| 323 } | 323 } |
| 324 | 324 |
| 325 // Factory for the implementations of AudioInputStream for AUDIO_PCM_LINEAR | 325 // Factory for the implementations of AudioInputStream for AUDIO_PCM_LINEAR |
| 326 // mode. | 326 // mode. |
| 327 AudioInputStream* AudioManagerWin::MakeLinearInputStream( | 327 AudioInputStream* AudioManagerWin::MakeLinearInputStream( |
| 328 const AudioParameters& params, const std::string& device_id) { | 328 const AudioParameters& params, const std::string& device_id) { |
| 329 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); | 329 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, | 445 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, |
| 446 xp_device_id); | 446 xp_device_id); |
| 447 } | 447 } |
| 448 | 448 |
| 449 /// static | 449 /// static |
| 450 AudioManager* CreateAudioManager() { | 450 AudioManager* CreateAudioManager() { |
| 451 return new AudioManagerWin(); | 451 return new AudioManagerWin(); |
| 452 } | 452 } |
| 453 | 453 |
| 454 } // namespace media | 454 } // namespace media |
| OLD | NEW |