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

Unified Diff: webrtc/modules/audio_processing/audio_buffer.cc

Issue 2741733002: Make AudioBuffer::InterleaveTo const (Closed)
Patch Set: Make InterleaveTo const Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_processing/audio_buffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/audio_buffer.cc
diff --git a/webrtc/modules/audio_processing/audio_buffer.cc b/webrtc/modules/audio_processing/audio_buffer.cc
index 02b8537c07857cc8085ec6cd1707fc2c69885624..579a5c24904aab28a857f9d7beca753888825404 100644
--- a/webrtc/modules/audio_processing/audio_buffer.cc
+++ b/webrtc/modules/audio_processing/audio_buffer.cc
@@ -61,7 +61,8 @@ AudioBuffer::AudioBuffer(size_t input_num_frames,
reference_copied_(false),
activity_(AudioFrame::kVadUnknown),
keyboard_data_(NULL),
- data_(new IFChannelBuffer(proc_num_frames_, num_proc_channels_)) {
+ data_(new IFChannelBuffer(proc_num_frames_, num_proc_channels_)),
+ output_buffer_(new IFChannelBuffer(output_num_frames_, num_channels_)) {
RTC_DCHECK_GT(input_num_frames_, 0);
RTC_DCHECK_GT(proc_num_frames_, 0);
RTC_DCHECK_GT(output_num_frames_, 0);
@@ -416,7 +417,7 @@ void AudioBuffer::DeinterleaveFrom(AudioFrame* frame) {
}
}
-void AudioBuffer::InterleaveTo(AudioFrame* frame, bool data_changed) {
+void AudioBuffer::InterleaveTo(AudioFrame* frame, bool data_changed) const {
frame->vad_activity_ = activity_;
if (!data_changed) {
return;
@@ -428,10 +429,6 @@ void AudioBuffer::InterleaveTo(AudioFrame* frame, bool data_changed) {
// Resample if necessary.
IFChannelBuffer* data_ptr = data_.get();
if (proc_num_frames_ != output_num_frames_) {
- if (!output_buffer_) {
- output_buffer_.reset(
- new IFChannelBuffer(output_num_frames_, num_channels_));
- }
for (size_t i = 0; i < num_channels_; ++i) {
output_resamplers_[i]->Resample(
data_->fbuf()->channels()[i], proc_num_frames_,
« no previous file with comments | « webrtc/modules/audio_processing/audio_buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698