Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: media/base/audio_buffer_converter.cc

Issue 212103013: Add channel_count parameter back to AudioBuffer creation methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mstr
Patch Set: fix unit test Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/audio_buffer.cc ('k') | media/base/audio_buffer_converter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/base/audio_buffer.cc ('k') | media/base/audio_buffer_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698