| 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..9376db82b85a9a3ed9f32bc2d9ecfe0825820e1e 100644
|
| --- a/media/audio/audio_low_latency_input_output_unittest.cc
|
| +++ b/media/audio/audio_low_latency_input_output_unittest.cc
|
| @@ -291,6 +291,11 @@ class AudioInputStreamTraits {
|
| AudioManagerBase::kDefaultDeviceId));
|
| }
|
|
|
| + // TODO(henrika): add support for GetAudioInputHardwareBufferSize in media.
|
| + 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 +311,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 +341,12 @@ 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.
|
| 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
|
| +
|
| + // Use the preferred buffer size. Note that the input side uses the same
|
| + // size as the output side in this implementation.
|
| + samples_per_packet_ = StreamTraits::HardwareBufferSize();
|
| }
|
|
|
| virtual ~StreamWrapper() {}
|
|
|