| 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 "media/base/audio_hardware_config.h" | 5 #include "media/base/audio_hardware_config.h" |
| 6 #include "media/audio/audio_parameters.h" | 6 #include "media/audio/audio_parameters.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace media { | 9 namespace media { |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 AudioParameters::AUDIO_PCM_LOW_LATENCY, | 80 AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 81 kNewInputChannelLayout, | 81 kNewInputChannelLayout, |
| 82 kNewInputSampleRate, | 82 kNewInputSampleRate, |
| 83 16, | 83 16, |
| 84 kOutputBufferSize); | 84 kOutputBufferSize); |
| 85 fake_config.UpdateInputConfig(new_input_params); | 85 fake_config.UpdateInputConfig(new_input_params); |
| 86 EXPECT_EQ(kNewInputSampleRate, fake_config.GetInputSampleRate()); | 86 EXPECT_EQ(kNewInputSampleRate, fake_config.GetInputSampleRate()); |
| 87 EXPECT_EQ(kNewInputChannelLayout, fake_config.GetInputChannelLayout()); | 87 EXPECT_EQ(kNewInputChannelLayout, fake_config.GetInputChannelLayout()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 TEST(AudioHardwareConfig, HighLatencyBufferSizes) { |
| 91 AudioParameters input_params(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 92 kInputChannelLayout, |
| 93 kInputSampleRate, |
| 94 16, |
| 95 kOutputBufferSize); |
| 96 AudioParameters output_params(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 97 kOutputChannelLayout, |
| 98 3200, |
| 99 16, |
| 100 32); |
| 101 AudioHardwareConfig fake_config(input_params, output_params); |
| 102 EXPECT_EQ(64, fake_config.GetHighLatencyBufferSize()); |
| 103 |
| 104 for (int i = 6400; i <= 204800; i *= 2) { |
| 105 fake_config.UpdateOutputConfig( |
| 106 AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 107 kOutputChannelLayout, |
| 108 i, |
| 109 16, |
| 110 32)); |
| 111 EXPECT_EQ(2 * (i / 100), fake_config.GetHighLatencyBufferSize()); |
| 112 } |
| 113 } |
| 114 |
| 90 } // namespace content | 115 } // namespace content |
| OLD | NEW |