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(base::TimeDelta(), base::TimeTicks::Now(), 0, | 118 expected_callback_->Render(expected_audio_bus_.get(), 0, 0); |
119 expected_audio_bus_.get()); | |
120 | 119 |
121 // Zero out unused channels in the expected AudioBus just as AudioConverter | 120 // Zero out unused channels in the expected AudioBus just as AudioConverter |
122 // would during channel mixing. | 121 // would during channel mixing. |
123 for (int i = input_parameters_.channels(); | 122 for (int i = input_parameters_.channels(); |
124 i < output_parameters_.channels(); ++i) { | 123 i < output_parameters_.channels(); ++i) { |
125 memset(expected_audio_bus_->channel(i), 0, | 124 memset(expected_audio_bus_->channel(i), 0, |
126 audio_bus_->frames() * sizeof(*audio_bus_->channel(i))); | 125 audio_bus_->frames() * sizeof(*audio_bus_->channel(i))); |
127 } | 126 } |
128 | 127 |
129 return ValidateAudioData(0, audio_bus_->frames(), scale); | 128 return ValidateAudioData(0, audio_bus_->frames(), scale); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // No resampling. No channel mixing. | 258 // No resampling. No channel mixing. |
260 std::tr1::make_tuple(44100, 44100, CHANNEL_LAYOUT_STEREO, 0.00000048), | 259 std::tr1::make_tuple(44100, 44100, CHANNEL_LAYOUT_STEREO, 0.00000048), |
261 | 260 |
262 // Upsampling. Channel upmixing. | 261 // Upsampling. Channel upmixing. |
263 std::tr1::make_tuple(44100, 48000, CHANNEL_LAYOUT_QUAD, 0.033), | 262 std::tr1::make_tuple(44100, 48000, CHANNEL_LAYOUT_QUAD, 0.033), |
264 | 263 |
265 // Downsampling. Channel downmixing. | 264 // Downsampling. Channel downmixing. |
266 std::tr1::make_tuple(48000, 41000, CHANNEL_LAYOUT_MONO, 0.042))); | 265 std::tr1::make_tuple(48000, 41000, CHANNEL_LAYOUT_MONO, 0.042))); |
267 | 266 |
268 } // namespace media | 267 } // namespace media |
OLD | NEW |