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 #include "media/base/audio_converter.h" | 5 #include "media/base/audio_converter.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 input_channel_count_(input_params.channels()) { | 23 input_channel_count_(input_params.channels()) { |
24 CHECK(input_params.IsValid()); | 24 CHECK(input_params.IsValid()); |
25 CHECK(output_params.IsValid()); | 25 CHECK(output_params.IsValid()); |
26 | 26 |
27 // Handle different input and output channel layouts. | 27 // Handle different input and output channel layouts. |
28 if (input_params.channel_layout() != output_params.channel_layout()) { | 28 if (input_params.channel_layout() != output_params.channel_layout()) { |
29 DVLOG(1) << "Remixing channel layout from " << input_params.channel_layout() | 29 DVLOG(1) << "Remixing channel layout from " << input_params.channel_layout() |
30 << " to " << output_params.channel_layout() << "; from " | 30 << " to " << output_params.channel_layout() << "; from " |
31 << input_params.channels() << " channels to " | 31 << input_params.channels() << " channels to " |
32 << output_params.channels() << " channels."; | 32 << output_params.channels() << " channels."; |
33 channel_mixer_.reset(new ChannelMixer(input_params, output_params)); | 33 channel_mixer_.reset(new ChannelMixer( |
| 34 input_params.channel_layout(), output_params.channel_layout())); |
34 | 35 |
35 // Pare off data as early as we can for efficiency. | 36 // Pare off data as early as we can for efficiency. |
36 downmix_early_ = input_params.channels() > output_params.channels(); | 37 downmix_early_ = input_params.channels() > output_params.channels(); |
37 if (downmix_early_) { | 38 if (downmix_early_) { |
38 DVLOG(1) << "Remixing channel layout prior to resampling."; | 39 DVLOG(1) << "Remixing channel layout prior to resampling."; |
39 // |unmixed_audio_| will be allocated on the fly. | 40 // |unmixed_audio_| will be allocated on the fly. |
40 } else { | 41 } else { |
41 // Instead, if we're not downmixing early we need a temporary AudioBus | 42 // Instead, if we're not downmixing early we need a temporary AudioBus |
42 // which matches the input channel count but uses the output frame size | 43 // which matches the input channel count but uses the output frame size |
43 // since we'll mix into the AudioBus from the output stream. | 44 // since we'll mix into the AudioBus from the output stream. |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 204 |
204 void AudioConverter::ProvideInput(int resampler_frame_delay, AudioBus* dest) { | 205 void AudioConverter::ProvideInput(int resampler_frame_delay, AudioBus* dest) { |
205 resampler_frame_delay_ = resampler_frame_delay; | 206 resampler_frame_delay_ = resampler_frame_delay; |
206 if (audio_fifo_) | 207 if (audio_fifo_) |
207 audio_fifo_->Consume(dest, dest->frames()); | 208 audio_fifo_->Consume(dest, dest->frames()); |
208 else | 209 else |
209 SourceCallback(0, dest); | 210 SourceCallback(0, dest); |
210 } | 211 } |
211 | 212 |
212 } // namespace media | 213 } // namespace media |
OLD | NEW |