| Index: media/base/audio_hardware_config_unittest.cc
|
| diff --git a/media/base/audio_hardware_config_unittest.cc b/media/base/audio_hardware_config_unittest.cc
|
| index 4a742bf51c89a0f77250f85518669f82e1f402e1..357ddca1e93c4a7048d5b474a2e88ce6044f8b4f 100644
|
| --- a/media/base/audio_hardware_config_unittest.cc
|
| +++ b/media/base/audio_hardware_config_unittest.cc
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "build/build_config.h"
|
| #include "media/base/audio_hardware_config.h"
|
| #include "media/audio/audio_parameters.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -87,4 +88,36 @@ TEST(AudioHardwareConfig, Setters) {
|
| EXPECT_EQ(kNewInputChannelLayout, fake_config.GetInputChannelLayout());
|
| }
|
|
|
| +TEST(AudioHardwareConfig, HighLatencyBufferSizes) {
|
| + AudioParameters input_params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
|
| + kInputChannelLayout,
|
| + kInputSampleRate,
|
| + 16,
|
| + kOutputBufferSize);
|
| + AudioParameters output_params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
|
| + kOutputChannelLayout,
|
| + 3200,
|
| + 16,
|
| + 32);
|
| + AudioHardwareConfig fake_config(input_params, output_params);
|
| +
|
| +#if defined(OS_LINUX)
|
| + EXPECT_EQ(64, fake_config.GetHighLatencyBufferSize());
|
| +
|
| + for (int i = 6400; i <= 204800; i *= 2) {
|
| + fake_config.UpdateOutputConfig(
|
| + AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
|
| + kOutputChannelLayout,
|
| + i,
|
| + 16,
|
| + 32));
|
| + EXPECT_EQ(2 * (i / 100), fake_config.GetHighLatencyBufferSize());
|
| + }
|
| +#else
|
| + // If high latency buffer sizes are not supported, the value should just pass
|
| + // through the output buffer size.
|
| + EXPECT_EQ(32, fake_config.GetHighLatencyBufferSize());
|
| +#endif
|
| +}
|
| +
|
| } // namespace content
|
|
|