OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_buffer_converter.h" | 5 #include "media/base/audio_buffer_converter.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "media/base/audio_buffer.h" | 10 #include "media/base/audio_buffer.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // How many output frames that corresponds to: | 181 // How many output frames that corresponds to: |
182 request_frames = chunks * audio_converter_->ChunkSize(); | 182 request_frames = chunks * audio_converter_->ChunkSize(); |
183 } | 183 } |
184 | 184 |
185 if (!request_frames) | 185 if (!request_frames) |
186 return; | 186 return; |
187 | 187 |
188 scoped_refptr<AudioBuffer> output_buffer = | 188 scoped_refptr<AudioBuffer> output_buffer = |
189 AudioBuffer::CreateBuffer(kSampleFormatPlanarF32, | 189 AudioBuffer::CreateBuffer(kSampleFormatPlanarF32, |
190 output_params_.channel_layout(), | 190 output_params_.channel_layout(), |
| 191 output_params_.channels(), |
191 output_params_.sample_rate(), | 192 output_params_.sample_rate(), |
192 request_frames); | 193 request_frames); |
193 scoped_ptr<AudioBus> output_bus = | 194 scoped_ptr<AudioBus> output_bus = |
194 AudioBus::CreateWrapper(output_buffer->channel_count()); | 195 AudioBus::CreateWrapper(output_buffer->channel_count()); |
195 | 196 |
196 int frames_remaining = request_frames; | 197 int frames_remaining = request_frames; |
197 | 198 |
198 // The AudioConverter wants requests of a fixed size, so we'll slide an | 199 // The AudioConverter wants requests of a fixed size, so we'll slide an |
199 // AudioBus of that size across the |output_buffer|. | 200 // AudioBus of that size across the |output_buffer|. |
200 while (frames_remaining != 0) { | 201 while (frames_remaining != 0) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 is_flushing_ = false; | 237 is_flushing_ = false; |
237 audio_converter_->Reset(); | 238 audio_converter_->Reset(); |
238 DCHECK_EQ(input_frames_, 0); | 239 DCHECK_EQ(input_frames_, 0); |
239 DCHECK_EQ(last_input_buffer_offset_, 0); | 240 DCHECK_EQ(last_input_buffer_offset_, 0); |
240 DCHECK_LT(buffered_input_frames_, 1.0); | 241 DCHECK_LT(buffered_input_frames_, 1.0); |
241 DCHECK(queued_inputs_.empty()); | 242 DCHECK(queued_inputs_.empty()); |
242 buffered_input_frames_ = 0.0; | 243 buffered_input_frames_ = 0.0; |
243 } | 244 } |
244 | 245 |
245 } // namespace media | 246 } // namespace media |
OLD | NEW |