Chromium Code Reviews| Index: media/audio/audio_low_latency_input_output_unittest.cc |
| diff --git a/media/audio/audio_low_latency_input_output_unittest.cc b/media/audio/audio_low_latency_input_output_unittest.cc |
| index 7ca7f03635d51f7b00e420e63474d1542223544f..43c1d9c61ad4a601725bfcefd00f632f2e7c4321 100644 |
| --- a/media/audio/audio_low_latency_input_output_unittest.cc |
| +++ b/media/audio/audio_low_latency_input_output_unittest.cc |
| @@ -291,6 +291,12 @@ class AudioInputStreamTraits { |
| AudioManagerBase::kDefaultDeviceId)); |
| } |
| + // TODO(henrika): add support for GetAudioInputHardwareBufferSize in media. |
| + // Using same buffer size as for the output side for now. |
|
tommi (sloooow) - chröme
2012/11/09 13:20:39
nit: move this line into the implementation since
henrika (OOO until Aug 14)
2012/11/09 13:30:57
Done.
|
| + static int HardwareBufferSize() { |
| + return static_cast<int>(media::GetAudioHardwareBufferSize()); |
| + } |
| + |
| static StreamType* CreateStream(AudioManager* audio_manager, |
| const AudioParameters& params) { |
| return audio_manager->MakeAudioInputStream(params, |
| @@ -306,6 +312,10 @@ class AudioOutputStreamTraits { |
| return static_cast<int>(media::GetAudioHardwareSampleRate()); |
| } |
| + static int HardwareBufferSize() { |
| + return static_cast<int>(media::GetAudioHardwareBufferSize()); |
| + } |
| + |
| static StreamType* CreateStream(AudioManager* audio_manager, |
| const AudioParameters& params) { |
| return audio_manager->MakeAudioOutputStream(params); |
| @@ -332,35 +342,9 @@ class StreamWrapper { |
| channel_layout_(CHANNEL_LAYOUT_STEREO), |
| #endif |
| bits_per_sample_(16) { |
| - // Use native/mixing sample rate and N*10ms frame size as default, |
| - // where N is platform dependent. |
| + // Use the preferred sample rate and buffer size. |
| sample_rate_ = StreamTraits::HardwareSampleRate(); |
| -#if defined(OS_MACOSX) |
| - // 10ms buffer size works well for 44.1, 48, 96 and 192kHz. |
| - samples_per_packet_ = (sample_rate_ / 100); |
| -#elif defined(OS_LINUX) || defined(OS_OPENBSD) |
| - // 10ms buffer size works well for 44.1, 48, 96 and 192kHz. |
| - samples_per_packet_ = (sample_rate_ / 100); |
| -#elif defined(OS_WIN) |
| - if (media::IsWASAPISupported()) { |
| - // WASAPI is supported for Windows Vista and higher. |
| - if (sample_rate_ == 44100) { |
| - // Tests have shown that the shared mode WASAPI implementation |
| - // works bests for a period size of ~10.15873 ms when the sample |
| - // rate is 44.1kHz. |
| - samples_per_packet_ = 448; |
| - } else { |
| - // 10ms buffer size works well for 48, 96 and 192kHz. |
| - samples_per_packet_ = (sample_rate_ / 100); |
| - } |
| - } else { |
| - // Low-latency Wave implementation needs 30ms buffer size to |
| - // ensure glitch-free output audio. |
| - samples_per_packet_ = 3 * (sample_rate_ / 100); |
| - } |
| -#elif defined(OS_ANDROID) |
| - samples_per_packet_ = (sample_rate_ / 100); |
| -#endif |
| + samples_per_packet_ = StreamTraits::HardwareBufferSize(); |
| } |
| virtual ~StreamWrapper() {} |