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