| 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 // AudioConverter implementation. Uses MultiChannelSincResampler for resampling | 5 // AudioConverter implementation. Uses MultiChannelSincResampler for resampling |
| 6 // audio, ChannelMixer for channel mixing, and AudioPullFifo for buffering. | 6 // audio, ChannelMixer for channel mixing, and AudioPullFifo for buffering. |
| 7 // | 7 // |
| 8 // Delay estimates are provided to InputCallbacks based on the frame delay | 8 // Delay estimates are provided to InputCallbacks based on the frame delay |
| 9 // information reported via the resampler and FIFO units. | 9 // information reported via the resampler and FIFO units. |
| 10 | 10 |
| 11 #include "media/base/audio_converter.h" | 11 #include "media/base/audio_converter.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 | 14 |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/bind_helpers.h" | 16 #include "base/bind_helpers.h" |
| 17 #include "media/base/audio_bus.h" |
| 17 #include "media/base/audio_pull_fifo.h" | 18 #include "media/base/audio_pull_fifo.h" |
| 18 #include "media/base/channel_mixer.h" | 19 #include "media/base/channel_mixer.h" |
| 19 #include "media/base/multi_channel_resampler.h" | 20 #include "media/base/multi_channel_resampler.h" |
| 20 #include "media/base/vector_math.h" | 21 #include "media/base/vector_math.h" |
| 21 | 22 |
| 22 namespace media { | 23 namespace media { |
| 23 | 24 |
| 24 AudioConverter::AudioConverter(const AudioParameters& input_params, | 25 AudioConverter::AudioConverter(const AudioParameters& input_params, |
| 25 const AudioParameters& output_params, | 26 const AudioParameters& output_params, |
| 26 bool disable_fifo) | 27 bool disable_fifo) |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 239 |
| 239 void AudioConverter::ProvideInput(int resampler_frame_delay, AudioBus* dest) { | 240 void AudioConverter::ProvideInput(int resampler_frame_delay, AudioBus* dest) { |
| 240 resampler_frame_delay_ = resampler_frame_delay; | 241 resampler_frame_delay_ = resampler_frame_delay; |
| 241 if (audio_fifo_) | 242 if (audio_fifo_) |
| 242 audio_fifo_->Consume(dest, dest->frames()); | 243 audio_fifo_->Consume(dest, dest->frames()); |
| 243 else | 244 else |
| 244 SourceCallback(0, dest); | 245 SourceCallback(0, dest); |
| 245 } | 246 } |
| 246 | 247 |
| 247 } // namespace media | 248 } // namespace media |
| OLD | NEW |