OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
7 | 7 |
8 #include "media/base/audio_converter.h" | 8 #include "media/base/audio_converter.h" |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 (output_parameters.frames_per_buffer() * input_sample_rate / | 222 (output_parameters.frames_per_buffer() * input_sample_rate / |
223 output_parameters.sample_rate()) / input_parameters.frames_per_buffer(); | 223 output_parameters.sample_rate()) / input_parameters.frames_per_buffer(); |
224 | 224 |
225 base::TimeDelta input_frame_duration = base::TimeDelta::FromMicroseconds( | 225 base::TimeDelta input_frame_duration = base::TimeDelta::FromMicroseconds( |
226 base::Time::kMicrosecondsPerSecond / input_sample_rate); | 226 base::Time::kMicrosecondsPerSecond / input_sample_rate); |
227 | 227 |
228 int expected_last_delay_milliseconds = | 228 int expected_last_delay_milliseconds = |
229 fill_count * input_parameters.frames_per_buffer() * | 229 fill_count * input_parameters.frames_per_buffer() * |
230 input_frame_duration.InMillisecondsF(); | 230 input_frame_duration.InMillisecondsF(); |
231 | 231 |
| 232 LOG(ERROR) << "fill count:" << fill_count |
| 233 << " expected_last_delay_milliseconds:" |
| 234 << expected_last_delay_milliseconds |
| 235 << " frames_per_buffer:" << input_parameters.frames_per_buffer() |
| 236 << " input_frame_duration_ms:" |
| 237 << input_frame_duration.InMillisecondsF(); |
| 238 |
232 EXPECT_EQ(expected_last_delay_milliseconds, | 239 EXPECT_EQ(expected_last_delay_milliseconds, |
233 callback.last_audio_delay_milliseconds()); | 240 callback.last_audio_delay_milliseconds()); |
234 EXPECT_EQ(input_parameters.channels(), callback.last_channel_count()); | 241 EXPECT_EQ(input_parameters.channels(), callback.last_channel_count()); |
235 } | 242 } |
236 | 243 |
237 TEST_P(AudioConverterTest, ArbitraryOutputRequestSize) { | 244 TEST_P(AudioConverterTest, ArbitraryOutputRequestSize) { |
238 // Resize output bus to be half of |output_parameters_|'s frames_per_buffer(). | 245 // Resize output bus to be half of |output_parameters_|'s frames_per_buffer(). |
239 audio_bus_ = AudioBus::Create(output_parameters_.channels(), | 246 audio_bus_ = AudioBus::Create(output_parameters_.channels(), |
240 output_parameters_.frames_per_buffer() / 2); | 247 output_parameters_.frames_per_buffer() / 2); |
241 RunTest(1); | 248 RunTest(1); |
(...skipping 17 matching lines...) Expand all Loading... |
259 // No resampling. No channel mixing. | 266 // No resampling. No channel mixing. |
260 std::tr1::make_tuple(44100, 44100, CHANNEL_LAYOUT_STEREO, 0.00000048), | 267 std::tr1::make_tuple(44100, 44100, CHANNEL_LAYOUT_STEREO, 0.00000048), |
261 | 268 |
262 // Upsampling. Channel upmixing. | 269 // Upsampling. Channel upmixing. |
263 std::tr1::make_tuple(44100, 48000, CHANNEL_LAYOUT_QUAD, 0.033), | 270 std::tr1::make_tuple(44100, 48000, CHANNEL_LAYOUT_QUAD, 0.033), |
264 | 271 |
265 // Downsampling. Channel downmixing. | 272 // Downsampling. Channel downmixing. |
266 std::tr1::make_tuple(48000, 41000, CHANNEL_LAYOUT_MONO, 0.042))); | 273 std::tr1::make_tuple(48000, 41000, CHANNEL_LAYOUT_MONO, 0.042))); |
267 | 274 |
268 } // namespace media | 275 } // namespace media |
OLD | NEW |