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, |
212 2, | 212 CHANNEL_LAYOUT_DISCRETE, kOutSampleRate, 16, 512); |
213 kOutSampleRate, | 213 output_params_.set_channels_for_discrete(2); |
214 16, | |
215 512, | |
216 0); | |
217 audio_buffer_converter_.reset(new AudioBufferConverter(output_params_)); | 214 audio_buffer_converter_.reset(new AudioBufferConverter(output_params_)); |
218 AddInput(MakeTestBuffer(kOutSampleRate, CHANNEL_LAYOUT_STEREO, 2, 512)); | 215 AddInput(MakeTestBuffer(kOutSampleRate, CHANNEL_LAYOUT_STEREO, 2, 512)); |
219 ConsumeAllOutput(); | 216 ConsumeAllOutput(); |
220 } | 217 } |
221 | 218 |
222 TEST_F(AudioBufferConverterTest, LargeBuffersResampling) { | 219 TEST_F(AudioBufferConverterTest, LargeBuffersResampling) { |
223 output_params_ = AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, | 220 output_params_ = AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
224 kOutChannelLayout, | 221 kOutChannelLayout, |
225 kOutSampleRate, | 222 kOutSampleRate, |
226 16, | 223 16, |
(...skipping 18 matching lines...) Expand all Loading... |
245 | 242 |
246 // Since the input buffer size is a multiple of the input request size there | 243 // Since the input buffer size is a multiple of the input request size there |
247 // should never be any frames remaining at this point. | 244 // should never be any frames remaining at this point. |
248 ASSERT_EQ(kInputFrameSize % | 245 ASSERT_EQ(kInputFrameSize % |
249 audio_buffer_converter_->input_buffer_size_for_testing(), | 246 audio_buffer_converter_->input_buffer_size_for_testing(), |
250 0); | 247 0); |
251 EXPECT_EQ(0, audio_buffer_converter_->input_frames_left_for_testing()); | 248 EXPECT_EQ(0, audio_buffer_converter_->input_frames_left_for_testing()); |
252 } | 249 } |
253 | 250 |
254 } // namespace media | 251 } // namespace media |
OLD | NEW |