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

Side by Side Diff: webrtc/common_audio/blocker.cc

Issue 1335923002: Add RTC_ prefix to (D)CHECKs and related macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 5 years, 3 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 | « webrtc/common_audio/audio_ring_buffer.cc ('k') | webrtc/common_audio/channel_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 num_output_channels_(num_output_channels), 111 num_output_channels_(num_output_channels),
112 initial_delay_(block_size_ - gcd(chunk_size, shift_amount)), 112 initial_delay_(block_size_ - gcd(chunk_size, shift_amount)),
113 frame_offset_(0), 113 frame_offset_(0),
114 input_buffer_(num_input_channels_, chunk_size_ + initial_delay_), 114 input_buffer_(num_input_channels_, chunk_size_ + initial_delay_),
115 output_buffer_(chunk_size_ + initial_delay_, num_output_channels_), 115 output_buffer_(chunk_size_ + initial_delay_, num_output_channels_),
116 input_block_(block_size_, num_input_channels_), 116 input_block_(block_size_, num_input_channels_),
117 output_block_(block_size_, num_output_channels_), 117 output_block_(block_size_, num_output_channels_),
118 window_(new float[block_size_]), 118 window_(new float[block_size_]),
119 shift_amount_(shift_amount), 119 shift_amount_(shift_amount),
120 callback_(callback) { 120 callback_(callback) {
121 CHECK_LE(num_output_channels_, num_input_channels_); 121 RTC_CHECK_LE(num_output_channels_, num_input_channels_);
122 CHECK_LE(shift_amount_, block_size_); 122 RTC_CHECK_LE(shift_amount_, block_size_);
123 123
124 memcpy(window_.get(), window, block_size_ * sizeof(*window_.get())); 124 memcpy(window_.get(), window, block_size_ * sizeof(*window_.get()));
125 input_buffer_.MoveReadPositionBackward(initial_delay_); 125 input_buffer_.MoveReadPositionBackward(initial_delay_);
126 } 126 }
127 127
128 // When block_size < chunk_size the input and output buffers look like this: 128 // When block_size < chunk_size the input and output buffers look like this:
129 // 129 //
130 // delay* chunk_size chunk_size + delay* 130 // delay* chunk_size chunk_size + delay*
131 // buffer: <-------------|---------------------|---------------|> 131 // buffer: <-------------|---------------------|---------------|>
132 // _a_ _b_ _c_ 132 // _a_ _b_ _c_
(...skipping 29 matching lines...) Expand all
162 // of |bl| and the border between sections _a_ and _b_. 162 // of |bl| and the border between sections _a_ and _b_.
163 // 163 //
164 // * delay here refers to inintial_delay_ 164 // * delay here refers to inintial_delay_
165 // 165 //
166 // TODO(claguna): Look at using ring buffers to eliminate some copies. 166 // TODO(claguna): Look at using ring buffers to eliminate some copies.
167 void Blocker::ProcessChunk(const float* const* input, 167 void Blocker::ProcessChunk(const float* const* input,
168 size_t chunk_size, 168 size_t chunk_size,
169 int num_input_channels, 169 int num_input_channels,
170 int num_output_channels, 170 int num_output_channels,
171 float* const* output) { 171 float* const* output) {
172 CHECK_EQ(chunk_size, chunk_size_); 172 RTC_CHECK_EQ(chunk_size, chunk_size_);
173 CHECK_EQ(num_input_channels, num_input_channels_); 173 RTC_CHECK_EQ(num_input_channels, num_input_channels_);
174 CHECK_EQ(num_output_channels, num_output_channels_); 174 RTC_CHECK_EQ(num_output_channels, num_output_channels_);
175 175
176 input_buffer_.Write(input, num_input_channels, chunk_size_); 176 input_buffer_.Write(input, num_input_channels, chunk_size_);
177 size_t first_frame_in_block = frame_offset_; 177 size_t first_frame_in_block = frame_offset_;
178 178
179 // Loop through blocks. 179 // Loop through blocks.
180 while (first_frame_in_block < chunk_size_) { 180 while (first_frame_in_block < chunk_size_) {
181 input_buffer_.Read(input_block_.channels(), num_input_channels, 181 input_buffer_.Read(input_block_.channels(), num_input_channels,
182 block_size_); 182 block_size_);
183 input_buffer_.MoveReadPositionBackward(block_size_ - shift_amount_); 183 input_buffer_.MoveReadPositionBackward(block_size_ - shift_amount_);
184 184
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 ZeroOut(output_buffer_.channels(), 227 ZeroOut(output_buffer_.channels(),
228 initial_delay_, 228 initial_delay_,
229 chunk_size_, 229 chunk_size_,
230 num_output_channels_); 230 num_output_channels_);
231 231
232 // Calculate new starting frames. 232 // Calculate new starting frames.
233 frame_offset_ = first_frame_in_block - chunk_size_; 233 frame_offset_ = first_frame_in_block - chunk_size_;
234 } 234 }
235 235
236 } // namespace webrtc 236 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/common_audio/audio_ring_buffer.cc ('k') | webrtc/common_audio/channel_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698