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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 return true; | 108 return true; |
109 } | 109 } |
110 | 110 |
111 // Runs a single Convert() stage, fills |expected_audio_bus_| appropriately, | 111 // Runs a single Convert() stage, fills |expected_audio_bus_| appropriately, |
112 // and validates equality with |audio_bus_| after |scale| is applied. | 112 // and validates equality with |audio_bus_| after |scale| is applied. |
113 bool RenderAndValidateAudioData(float scale) { | 113 bool RenderAndValidateAudioData(float scale) { |
114 // Render actual audio data. | 114 // Render actual audio data. |
115 converter_->Convert(audio_bus_.get()); | 115 converter_->Convert(audio_bus_.get()); |
116 | 116 |
117 // Render expected audio data. | 117 // Render expected audio data. |
118 expected_callback_->Render(expected_audio_bus_.get(), 0, 0); | 118 expected_callback_->Render(base::TimeDelta(), base::TimeTicks::Now(), 0, |
| 119 expected_audio_bus_.get()); |
119 | 120 |
120 // Zero out unused channels in the expected AudioBus just as AudioConverter | 121 // Zero out unused channels in the expected AudioBus just as AudioConverter |
121 // would during channel mixing. | 122 // would during channel mixing. |
122 for (int i = input_parameters_.channels(); | 123 for (int i = input_parameters_.channels(); |
123 i < output_parameters_.channels(); ++i) { | 124 i < output_parameters_.channels(); ++i) { |
124 memset(expected_audio_bus_->channel(i), 0, | 125 memset(expected_audio_bus_->channel(i), 0, |
125 audio_bus_->frames() * sizeof(*audio_bus_->channel(i))); | 126 audio_bus_->frames() * sizeof(*audio_bus_->channel(i))); |
126 } | 127 } |
127 | 128 |
128 return ValidateAudioData(0, audio_bus_->frames(), scale); | 129 return ValidateAudioData(0, audio_bus_->frames(), scale); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // No resampling. No channel mixing. | 259 // No resampling. No channel mixing. |
259 std::tr1::make_tuple(44100, 44100, CHANNEL_LAYOUT_STEREO, 0.00000048), | 260 std::tr1::make_tuple(44100, 44100, CHANNEL_LAYOUT_STEREO, 0.00000048), |
260 | 261 |
261 // Upsampling. Channel upmixing. | 262 // Upsampling. Channel upmixing. |
262 std::tr1::make_tuple(44100, 48000, CHANNEL_LAYOUT_QUAD, 0.033), | 263 std::tr1::make_tuple(44100, 48000, CHANNEL_LAYOUT_QUAD, 0.033), |
263 | 264 |
264 // Downsampling. Channel downmixing. | 265 // Downsampling. Channel downmixing. |
265 std::tr1::make_tuple(48000, 41000, CHANNEL_LAYOUT_MONO, 0.042))); | 266 std::tr1::make_tuple(48000, 41000, CHANNEL_LAYOUT_MONO, 0.042))); |
266 | 267 |
267 } // namespace media | 268 } // namespace media |
OLD | NEW |