| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API. | 281 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API. |
| 282 AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream( | 282 AudioOutputStream* AudioManagerWin::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 if (params.channels() > kWinMaxChannels) | 285 if (params.channels() > kWinMaxChannels) |
| 286 return NULL; | 286 return NULL; |
| 287 | 287 |
| 288 if (!CoreAudioUtil::IsSupported()) { | 288 if (!CoreAudioUtil::IsSupported()) { |
| 289 // Fall back to Windows Wave implementation on Windows XP or lower. | 289 // Fall back to Windows Wave implementation on Windows XP or lower. |
| 290 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista."; | 290 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista."; |
| 291 return new PCMWaveOutAudioOutputStream(this, params, 2, WAVE_MAPPER); | 291 return new PCMWaveOutAudioOutputStream( |
| 292 this, params, media::NumberOfWaveOutBuffers(), WAVE_MAPPER); |
| 292 } | 293 } |
| 293 | 294 |
| 294 // TODO(henrika): remove once we properly handle input device selection. | 295 // TODO(henrika): remove once we properly handle input device selection. |
| 295 if (CommandLine::ForCurrentProcess()->HasSwitch( | 296 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 296 switches::kEnableWebAudioInput)) { | 297 switches::kEnableWebAudioInput)) { |
| 297 if (WASAPIUnifiedStream::HasUnifiedDefaultIO()) { | 298 if (WASAPIUnifiedStream::HasUnifiedDefaultIO()) { |
| 298 DVLOG(1) << "WASAPIUnifiedStream is created."; | 299 DVLOG(1) << "WASAPIUnifiedStream is created."; |
| 299 return new WASAPIUnifiedStream(this, params); | 300 return new WASAPIUnifiedStream(this, params); |
| 300 } | 301 } |
| 301 LOG(WARNING) << "Unified audio I/O is not supported."; | 302 LOG(WARNING) << "Unified audio I/O is not supported."; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 channel_layout = WASAPIAudioOutputStream::HardwareChannelLayout(); | 368 channel_layout = WASAPIAudioOutputStream::HardwareChannelLayout(); |
| 368 } | 369 } |
| 369 | 370 |
| 370 // TODO(dalecurtis): This should include hardware bits per channel eventually. | 371 // TODO(dalecurtis): This should include hardware bits per channel eventually. |
| 371 return AudioParameters( | 372 return AudioParameters( |
| 372 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, | 373 AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, |
| 373 sample_rate, bits_per_sample, GetAudioHardwareBufferSize()); | 374 sample_rate, bits_per_sample, GetAudioHardwareBufferSize()); |
| 374 } | 375 } |
| 375 | 376 |
| 376 } // namespace media | 377 } // namespace media |
| OLD | NEW |