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

Side by Side Diff: webrtc/modules/audio_processing/audio_buffer.cc

Issue 2053773002: Keep track of the user-facing number of channels in a ChannelBuffer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebasing Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 memcpy(data[i], data[0], output_num_frames_ * sizeof(**data)); 177 memcpy(data[i], data[0], output_num_frames_ * sizeof(**data));
178 } 178 }
179 } 179 }
180 180
181 void AudioBuffer::InitForNewData() { 181 void AudioBuffer::InitForNewData() {
182 keyboard_data_ = NULL; 182 keyboard_data_ = NULL;
183 mixed_low_pass_valid_ = false; 183 mixed_low_pass_valid_ = false;
184 reference_copied_ = false; 184 reference_copied_ = false;
185 activity_ = AudioFrame::kVadUnknown; 185 activity_ = AudioFrame::kVadUnknown;
186 num_channels_ = num_proc_channels_; 186 num_channels_ = num_proc_channels_;
187 data_->set_num_channels(num_proc_channels_);
188 if (split_data_.get()) {
189 split_data_->set_num_channels(num_proc_channels_);
190 }
187 } 191 }
188 192
189 const int16_t* const* AudioBuffer::channels_const() const { 193 const int16_t* const* AudioBuffer::channels_const() const {
190 return data_->ibuf_const()->channels(); 194 return data_->ibuf_const()->channels();
191 } 195 }
192 196
193 int16_t* const* AudioBuffer::channels() { 197 int16_t* const* AudioBuffer::channels() {
194 mixed_low_pass_valid_ = false; 198 mixed_low_pass_valid_ = false;
195 return data_->ibuf()->channels(); 199 return data_->ibuf()->channels();
196 } 200 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 AudioFrame::VADActivity AudioBuffer::activity() const { 342 AudioFrame::VADActivity AudioBuffer::activity() const {
339 return activity_; 343 return activity_;
340 } 344 }
341 345
342 size_t AudioBuffer::num_channels() const { 346 size_t AudioBuffer::num_channels() const {
343 return num_channels_; 347 return num_channels_;
344 } 348 }
345 349
346 void AudioBuffer::set_num_channels(size_t num_channels) { 350 void AudioBuffer::set_num_channels(size_t num_channels) {
347 num_channels_ = num_channels; 351 num_channels_ = num_channels;
352 data_->set_num_channels(num_channels);
353 if (split_data_.get()) {
354 split_data_->set_num_channels(num_channels);
355 }
348 } 356 }
349 357
350 size_t AudioBuffer::num_frames() const { 358 size_t AudioBuffer::num_frames() const {
351 return proc_num_frames_; 359 return proc_num_frames_;
352 } 360 }
353 361
354 size_t AudioBuffer::num_frames_per_band() const { 362 size_t AudioBuffer::num_frames_per_band() const {
355 return num_split_frames_; 363 return num_split_frames_;
356 } 364 }
357 365
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 464
457 void AudioBuffer::SplitIntoFrequencyBands() { 465 void AudioBuffer::SplitIntoFrequencyBands() {
458 splitting_filter_->Analysis(data_.get(), split_data_.get()); 466 splitting_filter_->Analysis(data_.get(), split_data_.get());
459 } 467 }
460 468
461 void AudioBuffer::MergeFrequencyBands() { 469 void AudioBuffer::MergeFrequencyBands() {
462 splitting_filter_->Synthesis(split_data_.get(), data_.get()); 470 splitting_filter_->Synthesis(split_data_.get(), data_.get());
463 } 471 }
464 472
465 } // namespace webrtc 473 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/audio_buffer.h ('k') | webrtc/modules/audio_processing/audio_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698