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

Side by Side Diff: webrtc/modules/audio_processing/aec/aec_core.cc

Issue 2975043002: Remove internal buffer memory check in AEC module (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | no next file » | 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) 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void BlockBuffer::Insert(const float block[PART_LEN]) { 199 void BlockBuffer::Insert(const float block[PART_LEN]) {
200 WebRtc_WriteBuffer(buffer_, block, 1); 200 WebRtc_WriteBuffer(buffer_, block, 1);
201 } 201 }
202 202
203 void BlockBuffer::ExtractExtendedBlock(float extended_block[PART_LEN2]) { 203 void BlockBuffer::ExtractExtendedBlock(float extended_block[PART_LEN2]) {
204 float* block_ptr = NULL; 204 float* block_ptr = NULL;
205 RTC_DCHECK_LT(0, AvaliableSpace()); 205 RTC_DCHECK_LT(0, AvaliableSpace());
206 206
207 // Extract the previous block. 207 // Extract the previous block.
208 WebRtc_MoveReadPtr(buffer_, -1); 208 WebRtc_MoveReadPtr(buffer_, -1);
209 size_t read_elements = WebRtc_ReadBuffer( 209 WebRtc_ReadBuffer(buffer_, reinterpret_cast<void**>(&block_ptr),
210 buffer_, reinterpret_cast<void**>(&block_ptr), &extended_block[0], 1); 210 &extended_block[0], 1);
211 RTC_CHECK_EQ(read_elements, 1);
212 if (block_ptr != &extended_block[0]) { 211 if (block_ptr != &extended_block[0]) {
213 memcpy(&extended_block[0], block_ptr, PART_LEN * sizeof(float)); 212 memcpy(&extended_block[0], block_ptr, PART_LEN * sizeof(float));
214 } 213 }
215 214
216 // Extract the current block. 215 // Extract the current block.
217 read_elements = 216 WebRtc_ReadBuffer(buffer_, reinterpret_cast<void**>(&block_ptr),
218 WebRtc_ReadBuffer(buffer_, reinterpret_cast<void**>(&block_ptr), 217 &extended_block[PART_LEN], 1);
219 &extended_block[PART_LEN], 1);
220 RTC_CHECK_EQ(read_elements, 1);
221 if (block_ptr != &extended_block[PART_LEN]) { 218 if (block_ptr != &extended_block[PART_LEN]) {
222 memcpy(&extended_block[PART_LEN], block_ptr, PART_LEN * sizeof(float)); 219 memcpy(&extended_block[PART_LEN], block_ptr, PART_LEN * sizeof(float));
223 } 220 }
224 } 221 }
225 222
226 int BlockBuffer::AdjustSize(int buffer_size_decrease) { 223 int BlockBuffer::AdjustSize(int buffer_size_decrease) {
227 return WebRtc_MoveReadPtr(buffer_, buffer_size_decrease); 224 return WebRtc_MoveReadPtr(buffer_, buffer_size_decrease);
228 } 225 }
229 226
230 size_t BlockBuffer::Size() { 227 size_t BlockBuffer::Size() {
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 2038
2042 int WebRtcAec_system_delay(AecCore* self) { 2039 int WebRtcAec_system_delay(AecCore* self) {
2043 return self->system_delay; 2040 return self->system_delay;
2044 } 2041 }
2045 2042
2046 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { 2043 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) {
2047 RTC_DCHECK_GE(delay, 0); 2044 RTC_DCHECK_GE(delay, 0);
2048 self->system_delay = delay; 2045 self->system_delay = delay;
2049 } 2046 }
2050 } // namespace webrtc 2047 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698