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