| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 #include "media/base/audio_hardware_config.h" | 6 #include "media/base/audio_hardware_config.h" |
| 7 #include "media/base/audio_parameters.h" | 7 #include "media/base/audio_parameters.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 AudioParameters::AUDIO_PCM_LOW_LATENCY, | 81 AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 82 kNewInputChannelLayout, | 82 kNewInputChannelLayout, |
| 83 kNewInputSampleRate, | 83 kNewInputSampleRate, |
| 84 16, | 84 16, |
| 85 kOutputBufferSize); | 85 kOutputBufferSize); |
| 86 fake_config.UpdateInputConfig(new_input_params); | 86 fake_config.UpdateInputConfig(new_input_params); |
| 87 EXPECT_EQ(kNewInputSampleRate, fake_config.GetInputSampleRate()); | 87 EXPECT_EQ(kNewInputSampleRate, fake_config.GetInputSampleRate()); |
| 88 EXPECT_EQ(kNewInputChannelLayout, fake_config.GetInputChannelLayout()); | 88 EXPECT_EQ(kNewInputChannelLayout, fake_config.GetInputChannelLayout()); |
| 89 } | 89 } |
| 90 | 90 |
| 91 TEST(AudioHardwareConfig, HighLatencyBufferSizes) { | |
| 92 AudioParameters input_params(AudioParameters::AUDIO_PCM_LOW_LATENCY, | |
| 93 kInputChannelLayout, | |
| 94 kInputSampleRate, | |
| 95 16, | |
| 96 kOutputBufferSize); | |
| 97 AudioParameters output_params(AudioParameters::AUDIO_PCM_LOW_LATENCY, | |
| 98 kOutputChannelLayout, | |
| 99 3200, | |
| 100 16, | |
| 101 32); | |
| 102 AudioHardwareConfig fake_config(input_params, output_params); | |
| 103 | |
| 104 #if defined(OS_WIN) | |
| 105 for (int i = 6400; i <= 204800; i *= 2) { | |
| 106 fake_config.UpdateOutputConfig( | |
| 107 AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, | |
| 108 kOutputChannelLayout, | |
| 109 i, | |
| 110 16, | |
| 111 i / 100)); | |
| 112 EXPECT_EQ(2 * (i / 100), fake_config.GetHighLatencyBufferSize()); | |
| 113 } | |
| 114 #else | |
| 115 EXPECT_EQ(64, fake_config.GetHighLatencyBufferSize()); | |
| 116 | |
| 117 for (int i = 6400; i <= 204800; i *= 2) { | |
| 118 fake_config.UpdateOutputConfig( | |
| 119 AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, | |
| 120 kOutputChannelLayout, | |
| 121 i, | |
| 122 16, | |
| 123 32)); | |
| 124 EXPECT_EQ(2 * (i / 100), fake_config.GetHighLatencyBufferSize()); | |
| 125 } | |
| 126 #endif // defined(OS_WIN) | |
| 127 } | |
| 128 | |
| 129 } // namespace content | 91 } // namespace content |
| OLD | NEW |