// 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"
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) || defined(OS_MACOSX)
+ 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