| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 static int WebRtcAecm_DelayComp(AecMobile* aecmInst); | 81 static int WebRtcAecm_DelayComp(AecMobile* aecmInst); |
| 82 | 82 |
| 83 void* WebRtcAecm_Create() { | 83 void* WebRtcAecm_Create() { |
| 84 AecMobile* aecm = static_cast<AecMobile*>(malloc(sizeof(AecMobile))); | 84 AecMobile* aecm = static_cast<AecMobile*>(malloc(sizeof(AecMobile))); |
| 85 | 85 |
| 86 WebRtcSpl_Init(); | 86 WebRtcSpl_Init(); |
| 87 | 87 |
| 88 aecm->aecmCore = WebRtcAecm_CreateCore(); | 88 aecm->aecmCore = WebRtcAecm_CreateCore(); |
| 89 if (!aecm->aecmCore) { | 89 if (!aecm->aecmCore) { |
| 90 WebRtcAecm_Free(aecm); | 90 WebRtcAecm_Free(aecm); |
| 91 return NULL; | 91 return nullptr; |
| 92 } | 92 } |
| 93 | 93 |
| 94 aecm->farendBuf = WebRtc_CreateBuffer(kBufSizeSamp, | 94 aecm->farendBuf = WebRtc_CreateBuffer(kBufSizeSamp, |
| 95 sizeof(int16_t)); | 95 sizeof(int16_t)); |
| 96 if (!aecm->farendBuf) | 96 if (!aecm->farendBuf) |
| 97 { | 97 { |
| 98 WebRtcAecm_Free(aecm); | 98 WebRtcAecm_Free(aecm); |
| 99 return NULL; | 99 return nullptr; |
| 100 } | 100 } |
| 101 | 101 |
| 102 aecm->initFlag = 0; | 102 aecm->initFlag = 0; |
| 103 | 103 |
| 104 #ifdef AEC_DEBUG | 104 #ifdef AEC_DEBUG |
| 105 aecm->aecmCore->farFile = fopen("aecFar.pcm","wb"); | 105 aecm->aecmCore->farFile = fopen("aecFar.pcm","wb"); |
| 106 aecm->aecmCore->nearFile = fopen("aecNear.pcm","wb"); | 106 aecm->aecmCore->nearFile = fopen("aecNear.pcm","wb"); |
| 107 aecm->aecmCore->outFile = fopen("aecOut.pcm","wb"); | 107 aecm->aecmCore->outFile = fopen("aecOut.pcm","wb"); |
| 108 //aecm->aecmCore->outLpFile = fopen("aecOutLp.pcm","wb"); | 108 //aecm->aecmCore->outLpFile = fopen("aecOutLp.pcm","wb"); |
| 109 | 109 |
| 110 aecm->bufFile = fopen("aecBuf.dat", "wb"); | 110 aecm->bufFile = fopen("aecBuf.dat", "wb"); |
| 111 aecm->delayFile = fopen("aecDelay.dat", "wb"); | 111 aecm->delayFile = fopen("aecDelay.dat", "wb"); |
| 112 aecm->preCompFile = fopen("preComp.pcm", "wb"); | 112 aecm->preCompFile = fopen("preComp.pcm", "wb"); |
| 113 aecm->postCompFile = fopen("postComp.pcm", "wb"); | 113 aecm->postCompFile = fopen("postComp.pcm", "wb"); |
| 114 #endif // AEC_DEBUG | 114 #endif // AEC_DEBUG |
| 115 return aecm; | 115 return aecm; |
| 116 } | 116 } |
| 117 | 117 |
| 118 void WebRtcAecm_Free(void* aecmInst) { | 118 void WebRtcAecm_Free(void* aecmInst) { |
| 119 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); | 119 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); |
| 120 | 120 |
| 121 if (aecm == NULL) { | 121 if (aecm == nullptr) { |
| 122 return; | 122 return; |
| 123 } | 123 } |
| 124 | 124 |
| 125 #ifdef AEC_DEBUG | 125 #ifdef AEC_DEBUG |
| 126 fclose(aecm->aecmCore->farFile); | 126 fclose(aecm->aecmCore->farFile); |
| 127 fclose(aecm->aecmCore->nearFile); | 127 fclose(aecm->aecmCore->nearFile); |
| 128 fclose(aecm->aecmCore->outFile); | 128 fclose(aecm->aecmCore->outFile); |
| 129 //fclose(aecm->aecmCore->outLpFile); | 129 //fclose(aecm->aecmCore->outLpFile); |
| 130 | 130 |
| 131 fclose(aecm->bufFile); | 131 fclose(aecm->bufFile); |
| 132 fclose(aecm->delayFile); | 132 fclose(aecm->delayFile); |
| 133 fclose(aecm->preCompFile); | 133 fclose(aecm->preCompFile); |
| 134 fclose(aecm->postCompFile); | 134 fclose(aecm->postCompFile); |
| 135 #endif // AEC_DEBUG | 135 #endif // AEC_DEBUG |
| 136 WebRtcAecm_FreeCore(aecm->aecmCore); | 136 WebRtcAecm_FreeCore(aecm->aecmCore); |
| 137 WebRtc_FreeBuffer(aecm->farendBuf); | 137 WebRtc_FreeBuffer(aecm->farendBuf); |
| 138 free(aecm); | 138 free(aecm); |
| 139 } | 139 } |
| 140 | 140 |
| 141 int32_t WebRtcAecm_Init(void *aecmInst, int32_t sampFreq) | 141 int32_t WebRtcAecm_Init(void *aecmInst, int32_t sampFreq) |
| 142 { | 142 { |
| 143 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); | 143 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); |
| 144 AecmConfig aecConfig; | 144 AecmConfig aecConfig; |
| 145 | 145 |
| 146 if (aecm == NULL) | 146 if (aecm == nullptr) { |
| 147 { | 147 return -1; |
| 148 return -1; | |
| 149 } | 148 } |
| 150 | 149 |
| 151 if (sampFreq != 8000 && sampFreq != 16000) | 150 if (sampFreq != 8000 && sampFreq != 16000) |
| 152 { | 151 { |
| 153 return AECM_BAD_PARAMETER_ERROR; | 152 return AECM_BAD_PARAMETER_ERROR; |
| 154 } | 153 } |
| 155 aecm->sampFreq = sampFreq; | 154 aecm->sampFreq = sampFreq; |
| 156 | 155 |
| 157 // Initialize AECM core | 156 // Initialize AECM core |
| 158 if (WebRtcAecm_InitCore(aecm->aecmCore, aecm->sampFreq) == -1) | 157 if (WebRtcAecm_InitCore(aecm->aecmCore, aecm->sampFreq) == -1) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 192 |
| 194 return 0; | 193 return 0; |
| 195 } | 194 } |
| 196 | 195 |
| 197 // Returns any error that is caused when buffering the | 196 // Returns any error that is caused when buffering the |
| 198 // farend signal. | 197 // farend signal. |
| 199 int32_t WebRtcAecm_GetBufferFarendError(void *aecmInst, const int16_t *farend, | 198 int32_t WebRtcAecm_GetBufferFarendError(void *aecmInst, const int16_t *farend, |
| 200 size_t nrOfSamples) { | 199 size_t nrOfSamples) { |
| 201 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); | 200 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); |
| 202 | 201 |
| 203 if (aecm == NULL) | 202 if (aecm == nullptr) |
| 204 return -1; | 203 return -1; |
| 205 | 204 |
| 206 if (farend == NULL) | 205 if (farend == nullptr) |
| 207 return AECM_NULL_POINTER_ERROR; | 206 return AECM_NULL_POINTER_ERROR; |
| 208 | 207 |
| 209 if (aecm->initFlag != kInitCheck) | 208 if (aecm->initFlag != kInitCheck) |
| 210 return AECM_UNINITIALIZED_ERROR; | 209 return AECM_UNINITIALIZED_ERROR; |
| 211 | 210 |
| 212 if (nrOfSamples != 80 && nrOfSamples != 160) | 211 if (nrOfSamples != 80 && nrOfSamples != 160) |
| 213 return AECM_BAD_PARAMETER_ERROR; | 212 return AECM_BAD_PARAMETER_ERROR; |
| 214 | 213 |
| 215 return 0; | 214 return 0; |
| 216 } | 215 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 244 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); | 243 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); |
| 245 int32_t retVal = 0; | 244 int32_t retVal = 0; |
| 246 size_t i; | 245 size_t i; |
| 247 short nmbrOfFilledBuffers; | 246 short nmbrOfFilledBuffers; |
| 248 size_t nBlocks10ms; | 247 size_t nBlocks10ms; |
| 249 size_t nFrames; | 248 size_t nFrames; |
| 250 #ifdef AEC_DEBUG | 249 #ifdef AEC_DEBUG |
| 251 short msInAECBuf; | 250 short msInAECBuf; |
| 252 #endif | 251 #endif |
| 253 | 252 |
| 254 if (aecm == NULL) | 253 if (aecm == nullptr) { |
| 255 { | 254 return -1; |
| 256 return -1; | |
| 257 } | 255 } |
| 258 | 256 |
| 259 if (nearendNoisy == NULL) | 257 if (nearendNoisy == nullptr) { |
| 260 { | 258 return AECM_NULL_POINTER_ERROR; |
| 261 return AECM_NULL_POINTER_ERROR; | |
| 262 } | 259 } |
| 263 | 260 |
| 264 if (out == NULL) | 261 if (out == nullptr) { |
| 265 { | 262 return AECM_NULL_POINTER_ERROR; |
| 266 return AECM_NULL_POINTER_ERROR; | |
| 267 } | 263 } |
| 268 | 264 |
| 269 if (aecm->initFlag != kInitCheck) | 265 if (aecm->initFlag != kInitCheck) |
| 270 { | 266 { |
| 271 return AECM_UNINITIALIZED_ERROR; | 267 return AECM_UNINITIALIZED_ERROR; |
| 272 } | 268 } |
| 273 | 269 |
| 274 if (nrOfSamples != 80 && nrOfSamples != 160) | 270 if (nrOfSamples != 80 && nrOfSamples != 160) |
| 275 { | 271 { |
| 276 return AECM_BAD_PARAMETER_ERROR; | 272 return AECM_BAD_PARAMETER_ERROR; |
| 277 } | 273 } |
| 278 | 274 |
| 279 if (msInSndCardBuf < 0) | 275 if (msInSndCardBuf < 0) |
| 280 { | 276 { |
| 281 msInSndCardBuf = 0; | 277 msInSndCardBuf = 0; |
| 282 retVal = AECM_BAD_PARAMETER_WARNING; | 278 retVal = AECM_BAD_PARAMETER_WARNING; |
| 283 } else if (msInSndCardBuf > 500) | 279 } else if (msInSndCardBuf > 500) |
| 284 { | 280 { |
| 285 msInSndCardBuf = 500; | 281 msInSndCardBuf = 500; |
| 286 retVal = AECM_BAD_PARAMETER_WARNING; | 282 retVal = AECM_BAD_PARAMETER_WARNING; |
| 287 } | 283 } |
| 288 msInSndCardBuf += 10; | 284 msInSndCardBuf += 10; |
| 289 aecm->msInSndCardBuf = msInSndCardBuf; | 285 aecm->msInSndCardBuf = msInSndCardBuf; |
| 290 | 286 |
| 291 nFrames = nrOfSamples / FRAME_LEN; | 287 nFrames = nrOfSamples / FRAME_LEN; |
| 292 nBlocks10ms = nFrames / aecm->aecmCore->mult; | 288 nBlocks10ms = nFrames / aecm->aecmCore->mult; |
| 293 | 289 |
| 294 if (aecm->ECstartup) | 290 if (aecm->ECstartup) |
| 295 { | 291 { |
| 296 if (nearendClean == NULL) | 292 if (nearendClean == nullptr) { |
| 297 { | 293 if (out != nearendNoisy) { |
| 298 if (out != nearendNoisy) | 294 memcpy(out, nearendNoisy, sizeof(short) * nrOfSamples); |
| 299 { | 295 } |
| 300 memcpy(out, nearendNoisy, sizeof(short) * nrOfSamples); | |
| 301 } | |
| 302 } else if (out != nearendClean) | 296 } else if (out != nearendClean) |
| 303 { | 297 { |
| 304 memcpy(out, nearendClean, sizeof(short) * nrOfSamples); | 298 memcpy(out, nearendClean, sizeof(short) * nrOfSamples); |
| 305 } | 299 } |
| 306 | 300 |
| 307 nmbrOfFilledBuffers = | 301 nmbrOfFilledBuffers = |
| 308 (short) WebRtc_available_read(aecm->farendBuf) / FRAME_LEN; | 302 (short) WebRtc_available_read(aecm->farendBuf) / FRAME_LEN; |
| 309 // The AECM is in the start up mode | 303 // The AECM is in the start up mode |
| 310 // AECM is disabled until the soundcard buffer and farend buffers are OK | 304 // AECM is disabled until the soundcard buffer and farend buffers are OK |
| 311 | 305 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 369 } |
| 376 | 370 |
| 377 } else | 371 } else |
| 378 { | 372 { |
| 379 // AECM is enabled | 373 // AECM is enabled |
| 380 | 374 |
| 381 // Note only 1 block supported for nb and 2 blocks for wb | 375 // Note only 1 block supported for nb and 2 blocks for wb |
| 382 for (i = 0; i < nFrames; i++) | 376 for (i = 0; i < nFrames; i++) |
| 383 { | 377 { |
| 384 int16_t farend[FRAME_LEN]; | 378 int16_t farend[FRAME_LEN]; |
| 385 const int16_t* farend_ptr = NULL; | 379 const int16_t* farend_ptr = nullptr; |
| 386 | 380 |
| 387 nmbrOfFilledBuffers = | 381 nmbrOfFilledBuffers = |
| 388 (short) WebRtc_available_read(aecm->farendBuf) / FRAME_LEN; | 382 (short) WebRtc_available_read(aecm->farendBuf) / FRAME_LEN; |
| 389 | 383 |
| 390 // Check that there is data in the far end buffer | 384 // Check that there is data in the far end buffer |
| 391 if (nmbrOfFilledBuffers > 0) | 385 if (nmbrOfFilledBuffers > 0) |
| 392 { | 386 { |
| 393 // Get the next 80 samples from the farend buffer | 387 // Get the next 80 samples from the farend buffer |
| 394 WebRtc_ReadBuffer(aecm->farendBuf, (void**) &farend_ptr, farend, | 388 WebRtc_ReadBuffer(aecm->farendBuf, (void**) &farend_ptr, farend, |
| 395 FRAME_LEN); | 389 FRAME_LEN); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 407 // Call buffer delay estimator when all data is extracted, | 401 // Call buffer delay estimator when all data is extracted, |
| 408 // i,e. i = 0 for NB and i = 1 for WB | 402 // i,e. i = 0 for NB and i = 1 for WB |
| 409 if ((i == 0 && aecm->sampFreq == 8000) || (i == 1 && aecm->sampFreq
== 16000)) | 403 if ((i == 0 && aecm->sampFreq == 8000) || (i == 1 && aecm->sampFreq
== 16000)) |
| 410 { | 404 { |
| 411 WebRtcAecm_EstBufDelay(aecm, aecm->msInSndCardBuf); | 405 WebRtcAecm_EstBufDelay(aecm, aecm->msInSndCardBuf); |
| 412 } | 406 } |
| 413 | 407 |
| 414 // Call the AECM | 408 // Call the AECM |
| 415 /*WebRtcAecm_ProcessFrame(aecm->aecmCore, farend, &nearend[FRAME_LEN
* i], | 409 /*WebRtcAecm_ProcessFrame(aecm->aecmCore, farend, &nearend[FRAME_LEN
* i], |
| 416 &out[FRAME_LEN * i], aecm->knownDelay);*/ | 410 &out[FRAME_LEN * i], aecm->knownDelay);*/ |
| 417 if (WebRtcAecm_ProcessFrame(aecm->aecmCore, | 411 if (WebRtcAecm_ProcessFrame( |
| 418 farend_ptr, | 412 aecm->aecmCore, farend_ptr, &nearendNoisy[FRAME_LEN * i], |
| 419 &nearendNoisy[FRAME_LEN * i], | 413 (nearendClean ? &nearendClean[FRAME_LEN * i] : nullptr), |
| 420 (nearendClean | 414 &out[FRAME_LEN * i]) == -1) |
| 421 ? &nearendClean[FRAME_LEN * i] | 415 return -1; |
| 422 : NULL), | |
| 423 &out[FRAME_LEN * i]) == -1) | |
| 424 return -1; | |
| 425 } | 416 } |
| 426 } | 417 } |
| 427 | 418 |
| 428 #ifdef AEC_DEBUG | 419 #ifdef AEC_DEBUG |
| 429 msInAECBuf = (short) WebRtc_available_read(aecm->farendBuf) / | 420 msInAECBuf = (short) WebRtc_available_read(aecm->farendBuf) / |
| 430 (kSampMsNb * aecm->aecmCore->mult); | 421 (kSampMsNb * aecm->aecmCore->mult); |
| 431 fwrite(&msInAECBuf, 2, 1, aecm->bufFile); | 422 fwrite(&msInAECBuf, 2, 1, aecm->bufFile); |
| 432 fwrite(&(aecm->knownDelay), sizeof(aecm->knownDelay), 1, aecm->delayFile); | 423 fwrite(&(aecm->knownDelay), sizeof(aecm->knownDelay), 1, aecm->delayFile); |
| 433 #endif | 424 #endif |
| 434 | 425 |
| 435 return retVal; | 426 return retVal; |
| 436 } | 427 } |
| 437 | 428 |
| 438 int32_t WebRtcAecm_set_config(void *aecmInst, AecmConfig config) | 429 int32_t WebRtcAecm_set_config(void *aecmInst, AecmConfig config) |
| 439 { | 430 { |
| 440 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); | 431 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); |
| 441 | 432 |
| 442 if (aecm == NULL) | 433 if (aecm == nullptr) { |
| 443 { | 434 return -1; |
| 444 return -1; | |
| 445 } | 435 } |
| 446 | 436 |
| 447 if (aecm->initFlag != kInitCheck) | 437 if (aecm->initFlag != kInitCheck) |
| 448 { | 438 { |
| 449 return AECM_UNINITIALIZED_ERROR; | 439 return AECM_UNINITIALIZED_ERROR; |
| 450 } | 440 } |
| 451 | 441 |
| 452 if (config.cngMode != AecmFalse && config.cngMode != AecmTrue) | 442 if (config.cngMode != AecmFalse && config.cngMode != AecmTrue) |
| 453 { | 443 { |
| 454 return AECM_BAD_PARAMETER_ERROR; | 444 return AECM_BAD_PARAMETER_ERROR; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 return 0; | 504 return 0; |
| 515 } | 505 } |
| 516 | 506 |
| 517 int32_t WebRtcAecm_InitEchoPath(void* aecmInst, | 507 int32_t WebRtcAecm_InitEchoPath(void* aecmInst, |
| 518 const void* echo_path, | 508 const void* echo_path, |
| 519 size_t size_bytes) | 509 size_t size_bytes) |
| 520 { | 510 { |
| 521 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); | 511 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); |
| 522 const int16_t* echo_path_ptr = static_cast<const int16_t*>(echo_path); | 512 const int16_t* echo_path_ptr = static_cast<const int16_t*>(echo_path); |
| 523 | 513 |
| 524 if (aecmInst == NULL) { | 514 if (aecmInst == nullptr) { |
| 525 return -1; | 515 return -1; |
| 526 } | 516 } |
| 527 if (echo_path == NULL) { | 517 if (echo_path == nullptr) { |
| 528 return AECM_NULL_POINTER_ERROR; | 518 return AECM_NULL_POINTER_ERROR; |
| 529 } | 519 } |
| 530 if (size_bytes != WebRtcAecm_echo_path_size_bytes()) | 520 if (size_bytes != WebRtcAecm_echo_path_size_bytes()) |
| 531 { | 521 { |
| 532 // Input channel size does not match the size of AECM | 522 // Input channel size does not match the size of AECM |
| 533 return AECM_BAD_PARAMETER_ERROR; | 523 return AECM_BAD_PARAMETER_ERROR; |
| 534 } | 524 } |
| 535 if (aecm->initFlag != kInitCheck) | 525 if (aecm->initFlag != kInitCheck) |
| 536 { | 526 { |
| 537 return AECM_UNINITIALIZED_ERROR; | 527 return AECM_UNINITIALIZED_ERROR; |
| 538 } | 528 } |
| 539 | 529 |
| 540 WebRtcAecm_InitEchoPathCore(aecm->aecmCore, echo_path_ptr); | 530 WebRtcAecm_InitEchoPathCore(aecm->aecmCore, echo_path_ptr); |
| 541 | 531 |
| 542 return 0; | 532 return 0; |
| 543 } | 533 } |
| 544 | 534 |
| 545 int32_t WebRtcAecm_GetEchoPath(void* aecmInst, | 535 int32_t WebRtcAecm_GetEchoPath(void* aecmInst, |
| 546 void* echo_path, | 536 void* echo_path, |
| 547 size_t size_bytes) | 537 size_t size_bytes) |
| 548 { | 538 { |
| 549 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); | 539 AecMobile* aecm = static_cast<AecMobile*>(aecmInst); |
| 550 int16_t* echo_path_ptr = static_cast<int16_t*>(echo_path); | 540 int16_t* echo_path_ptr = static_cast<int16_t*>(echo_path); |
| 551 | 541 |
| 552 if (aecmInst == NULL) { | 542 if (aecmInst == nullptr) { |
| 553 return -1; | 543 return -1; |
| 554 } | 544 } |
| 555 if (echo_path == NULL) { | 545 if (echo_path == nullptr) { |
| 556 return AECM_NULL_POINTER_ERROR; | 546 return AECM_NULL_POINTER_ERROR; |
| 557 } | 547 } |
| 558 if (size_bytes != WebRtcAecm_echo_path_size_bytes()) | 548 if (size_bytes != WebRtcAecm_echo_path_size_bytes()) |
| 559 { | 549 { |
| 560 // Input channel size does not match the size of AECM | 550 // Input channel size does not match the size of AECM |
| 561 return AECM_BAD_PARAMETER_ERROR; | 551 return AECM_BAD_PARAMETER_ERROR; |
| 562 } | 552 } |
| 563 if (aecm->initFlag != kInitCheck) | 553 if (aecm->initFlag != kInitCheck) |
| 564 { | 554 { |
| 565 return AECM_UNINITIALIZED_ERROR; | 555 return AECM_UNINITIALIZED_ERROR; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 nSampAdd = (int)(WEBRTC_SPL_MAX(((nSampSndCard >> 1) - nSampFar), | 629 nSampAdd = (int)(WEBRTC_SPL_MAX(((nSampSndCard >> 1) - nSampFar), |
| 640 FRAME_LEN)); | 630 FRAME_LEN)); |
| 641 nSampAdd = WEBRTC_SPL_MIN(nSampAdd, maxStuffSamp); | 631 nSampAdd = WEBRTC_SPL_MIN(nSampAdd, maxStuffSamp); |
| 642 | 632 |
| 643 WebRtc_MoveReadPtr(aecm->farendBuf, -nSampAdd); | 633 WebRtc_MoveReadPtr(aecm->farendBuf, -nSampAdd); |
| 644 aecm->delayChange = 1; // the delay needs to be updated | 634 aecm->delayChange = 1; // the delay needs to be updated |
| 645 } | 635 } |
| 646 | 636 |
| 647 return 0; | 637 return 0; |
| 648 } | 638 } |
| OLD | NEW |