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