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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 input_params.channels(), | 91 input_params.channels(), |
92 input_params.frames_per_buffer(), base::Bind( | 92 input_params.frames_per_buffer(), base::Bind( |
93 &AudioConverter::SourceCallback, | 93 &AudioConverter::SourceCallback, |
94 base::Unretained(this)))); | 94 base::Unretained(this)))); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 AudioConverter::~AudioConverter() {} | 98 AudioConverter::~AudioConverter() {} |
99 | 99 |
100 void AudioConverter::AddInput(InputCallback* input) { | 100 void AudioConverter::AddInput(InputCallback* input) { |
101 // TODO(dalecurtis): Speculative CHECK for http://crbug.com/233026, should be | 101 DCHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) == |
102 // converted to a DCHECK once resolved. | 102 transform_inputs_.end()); |
103 CHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) == | |
104 transform_inputs_.end()); | |
105 transform_inputs_.push_back(input); | 103 transform_inputs_.push_back(input); |
106 } | 104 } |
107 | 105 |
108 void AudioConverter::RemoveInput(InputCallback* input) { | 106 void AudioConverter::RemoveInput(InputCallback* input) { |
109 DCHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) != | 107 DCHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) != |
110 transform_inputs_.end()); | 108 transform_inputs_.end()); |
111 transform_inputs_.remove(input); | 109 transform_inputs_.remove(input); |
112 | 110 |
113 if (transform_inputs_.empty()) | 111 if (transform_inputs_.empty()) |
114 Reset(); | 112 Reset(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 237 |
240 void AudioConverter::ProvideInput(int resampler_frame_delay, AudioBus* dest) { | 238 void AudioConverter::ProvideInput(int resampler_frame_delay, AudioBus* dest) { |
241 resampler_frame_delay_ = resampler_frame_delay; | 239 resampler_frame_delay_ = resampler_frame_delay; |
242 if (audio_fifo_) | 240 if (audio_fifo_) |
243 audio_fifo_->Consume(dest, dest->frames()); | 241 audio_fifo_->Consume(dest, dest->frames()); |
244 else | 242 else |
245 SourceCallback(0, dest); | 243 SourceCallback(0, dest); |
246 } | 244 } |
247 | 245 |
248 } // namespace media | 246 } // namespace media |
OLD | NEW |