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/audio/audio_parameters.h" | 7 #include "media/audio/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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 kInputSampleRate, | 94 kInputSampleRate, |
95 16, | 95 16, |
96 kOutputBufferSize); | 96 kOutputBufferSize); |
97 AudioParameters output_params(AudioParameters::AUDIO_PCM_LOW_LATENCY, | 97 AudioParameters output_params(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
98 kOutputChannelLayout, | 98 kOutputChannelLayout, |
99 3200, | 99 3200, |
100 16, | 100 16, |
101 32); | 101 32); |
102 AudioHardwareConfig fake_config(input_params, output_params); | 102 AudioHardwareConfig fake_config(input_params, output_params); |
103 | 103 |
104 #if defined(OS_LINUX) || defined(OS_MACOSX) | 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 |
105 EXPECT_EQ(64, fake_config.GetHighLatencyBufferSize()); | 115 EXPECT_EQ(64, fake_config.GetHighLatencyBufferSize()); |
106 | 116 |
107 for (int i = 6400; i <= 204800; i *= 2) { | 117 for (int i = 6400; i <= 204800; i *= 2) { |
108 fake_config.UpdateOutputConfig( | 118 fake_config.UpdateOutputConfig( |
109 AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, | 119 AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
110 kOutputChannelLayout, | 120 kOutputChannelLayout, |
111 i, | 121 i, |
112 16, | 122 16, |
113 32)); | 123 32)); |
114 EXPECT_EQ(2 * (i / 100), fake_config.GetHighLatencyBufferSize()); | 124 EXPECT_EQ(2 * (i / 100), fake_config.GetHighLatencyBufferSize()); |
115 } | 125 } |
116 #else | 126 #endif // defined(OS_WIN) |
117 // If high latency buffer sizes are not supported, the value should just pass | |
118 // through the output buffer size. | |
119 EXPECT_EQ(32, fake_config.GetHighLatencyBufferSize()); | |
120 #endif | |
121 } | 127 } |
122 | 128 |
123 } // namespace content | 129 } // namespace content |
OLD | NEW |