OLD | NEW |
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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 farend_ptr = new_farend; | 310 farend_ptr = new_farend; |
311 } | 311 } |
312 | 312 |
313 aecpc->farend_started = 1; | 313 aecpc->farend_started = 1; |
314 WebRtcAec_SetSystemDelay( | 314 WebRtcAec_SetSystemDelay( |
315 aecpc->aec, WebRtcAec_system_delay(aecpc->aec) + (int)newNrOfSamples); | 315 aecpc->aec, WebRtcAec_system_delay(aecpc->aec) + (int)newNrOfSamples); |
316 | 316 |
317 // Write the time-domain data to |far_pre_buf|. | 317 // Write the time-domain data to |far_pre_buf|. |
318 WebRtc_WriteBuffer(aecpc->far_pre_buf, farend_ptr, newNrOfSamples); | 318 WebRtc_WriteBuffer(aecpc->far_pre_buf, farend_ptr, newNrOfSamples); |
319 | 319 |
320 // Transform to frequency domain if we have enough data. | 320 // TODO(minyue): reduce to |PART_LEN| samples for each buffering, when |
| 321 // WebRtcAec_BufferFarendPartition() is changed to take |PART_LEN| samples. |
321 while (WebRtc_available_read(aecpc->far_pre_buf) >= PART_LEN2) { | 322 while (WebRtc_available_read(aecpc->far_pre_buf) >= PART_LEN2) { |
322 // We have enough data to pass to the FFT, hence read PART_LEN2 samples. | 323 // We have enough data to pass to the FFT, hence read PART_LEN2 samples. |
323 { | 324 { |
324 float* ptmp = NULL; | 325 float* ptmp = NULL; |
325 float tmp[PART_LEN2]; | 326 float tmp[PART_LEN2]; |
326 WebRtc_ReadBuffer(aecpc->far_pre_buf, (void**)&ptmp, tmp, PART_LEN2); | 327 WebRtc_ReadBuffer(aecpc->far_pre_buf, (void**)&ptmp, tmp, PART_LEN2); |
327 WebRtcAec_BufferFarendPartition(aecpc->aec, ptmp); | 328 WebRtcAec_BufferFarendPartition(aecpc->aec, ptmp); |
328 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
329 WebRtc_WriteBuffer( | |
330 WebRtcAec_far_time_buf(aecpc->aec), &ptmp[PART_LEN], 1); | |
331 #endif | |
332 } | 329 } |
333 | 330 |
334 // Rewind |far_pre_buf| PART_LEN samples for overlap before continuing. | 331 // Rewind |far_pre_buf| PART_LEN samples for overlap before continuing. |
335 WebRtc_MoveReadPtr(aecpc->far_pre_buf, -PART_LEN); | 332 WebRtc_MoveReadPtr(aecpc->far_pre_buf, -PART_LEN); |
336 } | 333 } |
337 | 334 |
338 return 0; | 335 return 0; |
339 } | 336 } |
340 | 337 |
341 int32_t WebRtcAec_Process(void* aecInst, | 338 int32_t WebRtcAec_Process(void* aecInst, |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 } | 893 } |
897 } else { | 894 } else { |
898 self->timeForDelayChange = 0; | 895 self->timeForDelayChange = 0; |
899 } | 896 } |
900 self->lastDelayDiff = delay_difference; | 897 self->lastDelayDiff = delay_difference; |
901 | 898 |
902 if (self->timeForDelayChange > 25) { | 899 if (self->timeForDelayChange > 25) { |
903 self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0); | 900 self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0); |
904 } | 901 } |
905 } | 902 } |
OLD | NEW |