OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "media/base/audio_buffer.h" | 6 #include "media/base/audio_buffer.h" |
7 #include "media/base/audio_buffer_converter.h" | 7 #include "media/base/audio_buffer_converter.h" |
8 #include "media/base/sinc_resampler.h" | 8 #include "media/base/sinc_resampler.h" |
9 #include "media/base/test_helpers.h" | 9 #include "media/base/test_helpers.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 AddInput( | 200 AddInput( |
201 MakeTestBuffer(kOutSampleRate, kOutChannelLayout, kOutChannelCount, 512)); | 201 MakeTestBuffer(kOutSampleRate, kOutChannelLayout, kOutChannelCount, 512)); |
202 Reset(); | 202 Reset(); |
203 // Make sure we can keep using the AudioBufferConverter after we've Reset(). | 203 // Make sure we can keep using the AudioBufferConverter after we've Reset(). |
204 AddInput( | 204 AddInput( |
205 MakeTestBuffer(kOutSampleRate, kOutChannelLayout, kOutChannelCount, 512)); | 205 MakeTestBuffer(kOutSampleRate, kOutChannelLayout, kOutChannelCount, 512)); |
206 ConsumeAllOutput(); | 206 ConsumeAllOutput(); |
207 } | 207 } |
208 | 208 |
209 TEST_F(AudioBufferConverterTest, DiscreteChannelLayout) { | 209 TEST_F(AudioBufferConverterTest, DiscreteChannelLayout) { |
210 output_params_ = AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, | 210 output_params_ = |
211 CHANNEL_LAYOUT_DISCRETE, | 211 AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, 2, |
212 2, | 212 CHANNEL_LAYOUT_DISCRETE, kOutSampleRate, 16, 512); |
213 kOutSampleRate, | |
214 16, | |
215 512, | |
216 0); | |
217 audio_buffer_converter_.reset(new AudioBufferConverter(output_params_)); | 213 audio_buffer_converter_.reset(new AudioBufferConverter(output_params_)); |
218 AddInput(MakeTestBuffer(kOutSampleRate, CHANNEL_LAYOUT_STEREO, 2, 512)); | 214 AddInput(MakeTestBuffer(kOutSampleRate, CHANNEL_LAYOUT_STEREO, 2, 512)); |
219 ConsumeAllOutput(); | 215 ConsumeAllOutput(); |
220 } | 216 } |
221 | 217 |
222 TEST_F(AudioBufferConverterTest, LargeBuffersResampling) { | 218 TEST_F(AudioBufferConverterTest, LargeBuffersResampling) { |
223 output_params_ = AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, | 219 output_params_ = AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
224 kOutChannelLayout, | 220 kOutChannelLayout, |
225 kOutSampleRate, | 221 kOutSampleRate, |
226 16, | 222 16, |
(...skipping 18 matching lines...) Expand all Loading... |
245 | 241 |
246 // Since the input buffer size is a multiple of the input request size there | 242 // Since the input buffer size is a multiple of the input request size there |
247 // should never be any frames remaining at this point. | 243 // should never be any frames remaining at this point. |
248 ASSERT_EQ(kInputFrameSize % | 244 ASSERT_EQ(kInputFrameSize % |
249 audio_buffer_converter_->input_buffer_size_for_testing(), | 245 audio_buffer_converter_->input_buffer_size_for_testing(), |
250 0); | 246 0); |
251 EXPECT_EQ(0, audio_buffer_converter_->input_frames_left_for_testing()); | 247 EXPECT_EQ(0, audio_buffer_converter_->input_frames_left_for_testing()); |
252 } | 248 } |
253 | 249 |
254 } // namespace media | 250 } // namespace media |
OLD | NEW |