| 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 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 if (resampler_) | 110 if (resampler_) |
| 111 resampler_->Flush(); | 111 resampler_->Flush(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 int AudioConverter::ChunkSize() const { | 114 int AudioConverter::ChunkSize() const { |
| 115 if (!resampler_) | 115 if (!resampler_) |
| 116 return chunk_size_; | 116 return chunk_size_; |
| 117 return resampler_->ChunkSize(); | 117 return resampler_->ChunkSize(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void AudioConverter::PrimeWithSilence() { |
| 121 if (resampler_) { |
| 122 resampler_->PrimeWithSilence(); |
| 123 } |
| 124 } |
| 125 |
| 120 void AudioConverter::ConvertWithDelay(const base::TimeDelta& initial_delay, | 126 void AudioConverter::ConvertWithDelay(const base::TimeDelta& initial_delay, |
| 121 AudioBus* dest) { | 127 AudioBus* dest) { |
| 122 initial_delay_ = initial_delay; | 128 initial_delay_ = initial_delay; |
| 123 | 129 |
| 124 if (transform_inputs_.empty()) { | 130 if (transform_inputs_.empty()) { |
| 125 dest->Zero(); | 131 dest->Zero(); |
| 126 return; | 132 return; |
| 127 } | 133 } |
| 128 | 134 |
| 129 // Determine if channel mixing should be done and if it should be done before | 135 // Determine if channel mixing should be done and if it should be done before |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 else | 249 else |
| 244 SourceCallback(0, dest); | 250 SourceCallback(0, dest); |
| 245 } | 251 } |
| 246 | 252 |
| 247 void AudioConverter::CreateUnmixedAudioIfNecessary(int frames) { | 253 void AudioConverter::CreateUnmixedAudioIfNecessary(int frames) { |
| 248 if (!unmixed_audio_ || unmixed_audio_->frames() != frames) | 254 if (!unmixed_audio_ || unmixed_audio_->frames() != frames) |
| 249 unmixed_audio_ = AudioBus::Create(input_channel_count_, frames); | 255 unmixed_audio_ = AudioBus::Create(input_channel_count_, frames); |
| 250 } | 256 } |
| 251 | 257 |
| 252 } // namespace media | 258 } // namespace media |
| OLD | NEW |