| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 310 |
| 311 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, | 311 return new PCMWaveInAudioInputStream(this, params, kNumInputBuffers, |
| 312 xp_device_id); | 312 xp_device_id); |
| 313 } | 313 } |
| 314 | 314 |
| 315 /// static | 315 /// static |
| 316 AudioManager* CreateAudioManager() { | 316 AudioManager* CreateAudioManager() { |
| 317 return new AudioManagerWin(); | 317 return new AudioManagerWin(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 AudioParameters AudioManagerWin::GetPreferredLowLatencyOutputStreamParameters( |
| 321 const AudioParameters& input_params) { |
| 322 // If WASAPI isn't supported we'll fallback to WaveOut, which will take care |
| 323 // of resampling and bits per sample changes. By setting these equal to the |
| 324 // input values, AudioOutputResampler will skip resampling and bit per sample |
| 325 // differences (since the input parameters will match the output parameters). |
| 326 int sample_rate = input_params.sample_rate(); |
| 327 int bits_per_sample = input_params.bits_per_sample(); |
| 328 if (IsWASAPISupported()) { |
| 329 sample_rate = GetAudioHardwareSampleRate(); |
| 330 bits_per_sample = 16; |
| 331 } |
| 332 |
| 333 // TODO(dalecurtis): This should include bits per channel and channel layout |
| 334 // eventually. |
| 335 return AudioParameters( |
| 336 AudioParameters::AUDIO_PCM_LOW_LATENCY, input_params.channel_layout(), |
| 337 sample_rate, bits_per_sample, GetAudioHardwareBufferSize()); |
| 338 } |
| 339 |
| 320 } // namespace media | 340 } // namespace media |
| OLD | NEW |