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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 // Factory for the implementations of AudioOutputStream for | 304 // Factory for the implementations of AudioOutputStream for |
305 // AUDIO_PCM_LOW_LATENCY mode. Two implementations should suffice most | 305 // AUDIO_PCM_LOW_LATENCY mode. Two implementations should suffice most |
306 // windows user's needs. | 306 // windows user's needs. |
307 // - PCMWaveOutAudioOutputStream: Based on the waveOut API. | 307 // - PCMWaveOutAudioOutputStream: Based on the waveOut API. |
308 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API. | 308 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API. |
309 AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream( | 309 AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream( |
310 const AudioParameters& params, | 310 const AudioParameters& params, |
311 const std::string& device_id, | 311 const std::string& device_id, |
312 const std::string& input_device_id) { | 312 const std::string& input_device_id) { |
313 DLOG_IF(ERROR, !device_id.empty()) << "Not implemented!"; | |
314 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); | 313 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); |
315 if (params.channels() > kWinMaxChannels) | 314 if (params.channels() > kWinMaxChannels) |
316 return NULL; | 315 return NULL; |
317 | 316 |
318 if (!CoreAudioUtil::IsSupported()) { | 317 if (!CoreAudioUtil::IsSupported()) { |
319 // Fall back to Windows Wave implementation on Windows XP or lower. | 318 // Fall back to Windows Wave implementation on Windows XP or lower. |
| 319 DLOG_IF(ERROR, !device_id.empty()) |
| 320 << "Opening by device id not supported by PCMWaveOutAudioOutputStream"; |
320 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista."; | 321 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista."; |
321 return new PCMWaveOutAudioOutputStream( | 322 return new PCMWaveOutAudioOutputStream( |
322 this, params, media::NumberOfWaveOutBuffers(), WAVE_MAPPER); | 323 this, params, media::NumberOfWaveOutBuffers(), WAVE_MAPPER); |
323 } | 324 } |
324 | 325 |
325 // TODO(rtoy): support more than stereo input. | 326 // TODO(rtoy): support more than stereo input. |
326 if (params.input_channels() > 0) { | 327 if (params.input_channels() > 0) { |
327 DVLOG(1) << "WASAPIUnifiedStream is created."; | 328 DVLOG(1) << "WASAPIUnifiedStream is created."; |
| 329 DLOG_IF(ERROR, !device_id.empty()) |
| 330 << "Opening by device id not supported by WASAPIUnifiedStream"; |
328 return new WASAPIUnifiedStream(this, params, input_device_id); | 331 return new WASAPIUnifiedStream(this, params, input_device_id); |
329 } | 332 } |
330 | 333 |
331 return new WASAPIAudioOutputStream(this, params, eConsole); | 334 return new WASAPIAudioOutputStream(this, device_id, params, eConsole); |
332 } | 335 } |
333 | 336 |
334 // Factory for the implementations of AudioInputStream for AUDIO_PCM_LINEAR | 337 // Factory for the implementations of AudioInputStream for AUDIO_PCM_LINEAR |
335 // mode. | 338 // mode. |
336 AudioInputStream* AudioManagerWin::MakeLinearInputStream( | 339 AudioInputStream* AudioManagerWin::MakeLinearInputStream( |
337 const AudioParameters& params, const std::string& device_id) { | 340 const AudioParameters& params, const std::string& device_id) { |
338 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); | 341 DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); |
339 return CreatePCMWaveInAudioInputStream(params, device_id); | 342 return CreatePCMWaveInAudioInputStream(params, device_id); |
340 } | 343 } |
341 | 344 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, | 472 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, |
470 xp_device_id); | 473 xp_device_id); |
471 } | 474 } |
472 | 475 |
473 /// static | 476 /// static |
474 AudioManager* CreateAudioManager() { | 477 AudioManager* CreateAudioManager() { |
475 return new AudioManagerWin(); | 478 return new AudioManagerWin(); |
476 } | 479 } |
477 | 480 |
478 } // namespace media | 481 } // namespace media |
OLD | NEW |