Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(889)

Unified Diff: media/base/audio_hardware_config_unittest.cc

Issue 235723003: Use larger buffer sizes for lower power on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test on other platforms. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/audio_hardware_config.cc ('k') | media/filters/audio_renderer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « media/base/audio_hardware_config.cc ('k') | media/filters/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698