| 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/win/audio_manager_win.h" | 5 #include "media/audio/win/audio_manager_win.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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 WAVE_MAPPER); | 346 WAVE_MAPPER); |
| 347 } | 347 } |
| 348 | 348 |
| 349 // Factory for the implementations of AudioOutputStream for | 349 // Factory for the implementations of AudioOutputStream for |
| 350 // AUDIO_PCM_LOW_LATENCY mode. Two implementations should suffice most | 350 // AUDIO_PCM_LOW_LATENCY mode. Two implementations should suffice most |
| 351 // windows user's needs. | 351 // windows user's needs. |
| 352 // - PCMWaveOutAudioOutputStream: Based on the waveOut API. | 352 // - PCMWaveOutAudioOutputStream: Based on the waveOut API. |
| 353 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API. | 353 // - WASAPIAudioOutputStream: Based on Core Audio (WASAPI) API. |
| 354 AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream( | 354 AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream( |
| 355 const AudioParameters& params, | 355 const AudioParameters& params, |
| 356 const std::string& device_id) { | 356 const std::string& device_id, |
| 357 const StatisticsCallback& statistics_callback) { |
| 357 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); | 358 DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); |
| 358 if (params.channels() > kWinMaxChannels) | 359 if (params.channels() > kWinMaxChannels) |
| 359 return NULL; | 360 return NULL; |
| 360 | 361 |
| 361 if (!core_audio_supported()) { | 362 if (!core_audio_supported()) { |
| 362 // Fall back to Windows Wave implementation on Windows XP or lower. | 363 // Fall back to Windows Wave implementation on Windows XP or lower. |
| 363 DLOG_IF(ERROR, !device_id.empty() && | 364 DLOG_IF(ERROR, !device_id.empty() && |
| 364 device_id != AudioDeviceDescription::kDefaultDeviceId) | 365 device_id != AudioDeviceDescription::kDefaultDeviceId) |
| 365 << "Opening by device id not supported by PCMWaveOutAudioOutputStream"; | 366 << "Opening by device id not supported by PCMWaveOutAudioOutputStream"; |
| 366 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista."; | 367 DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista."; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 ScopedAudioManagerPtr CreateAudioManager( | 537 ScopedAudioManagerPtr CreateAudioManager( |
| 537 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 538 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 538 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, | 539 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner, |
| 539 AudioLogFactory* audio_log_factory) { | 540 AudioLogFactory* audio_log_factory) { |
| 540 return ScopedAudioManagerPtr( | 541 return ScopedAudioManagerPtr( |
| 541 new AudioManagerWin(std::move(task_runner), std::move(worker_task_runner), | 542 new AudioManagerWin(std::move(task_runner), std::move(worker_task_runner), |
| 542 audio_log_factory)); | 543 audio_log_factory)); |
| 543 } | 544 } |
| 544 | 545 |
| 545 } // namespace media | 546 } // namespace media |
| OLD | NEW |