Chromium Code Reviews| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 } | 185 } |
| 186 | 186 |
| 187 int32_t WebRtcAec_Init(void* aecInst, int32_t sampFreq, int32_t scSampFreq) { | 187 int32_t WebRtcAec_Init(void* aecInst, int32_t sampFreq, int32_t scSampFreq) { |
| 188 Aec* aecpc = aecInst; | 188 Aec* aecpc = aecInst; |
| 189 AecConfig aecConfig; | 189 AecConfig aecConfig; |
| 190 | 190 |
| 191 if (sampFreq != 8000 && | 191 if (sampFreq != 8000 && |
| 192 sampFreq != 16000 && | 192 sampFreq != 16000 && |
| 193 sampFreq != 32000 && | 193 sampFreq != 32000 && |
| 194 sampFreq != 48000) { | 194 sampFreq != 48000) { |
| 195 aecpc->lastError = AEC_BAD_PARAMETER_ERROR; | 195 return AEC_BAD_PARAMETER_ERROR; |
|
hlundin-webrtc
2015/10/14 14:34:49
You should be able to remove this struct member to
peah-webrtc
2015/10/14 17:57:36
Good catch!
peah-webrtc
2015/10/14 17:57:36
Done.
| |
| 196 return -1; | |
| 197 } | 196 } |
| 198 aecpc->sampFreq = sampFreq; | 197 aecpc->sampFreq = sampFreq; |
| 199 | 198 |
| 200 if (scSampFreq < 1 || scSampFreq > 96000) { | 199 if (scSampFreq < 1 || scSampFreq > 96000) { |
| 201 aecpc->lastError = AEC_BAD_PARAMETER_ERROR; | 200 return AEC_BAD_PARAMETER_ERROR; |
| 202 return -1; | |
| 203 } | 201 } |
| 204 aecpc->scSampFreq = scSampFreq; | 202 aecpc->scSampFreq = scSampFreq; |
| 205 | 203 |
| 206 // Initialize echo canceller core | 204 // Initialize echo canceller core |
| 207 if (WebRtcAec_InitAec(aecpc->aec, aecpc->sampFreq) == -1) { | 205 if (WebRtcAec_InitAec(aecpc->aec, aecpc->sampFreq) == -1) { |
| 208 aecpc->lastError = AEC_UNSPECIFIED_ERROR; | 206 return AEC_UNSPECIFIED_ERROR; |
| 209 return -1; | |
| 210 } | 207 } |
| 211 | 208 |
| 212 if (WebRtcAec_InitResampler(aecpc->resampler, aecpc->scSampFreq) == -1) { | 209 if (WebRtcAec_InitResampler(aecpc->resampler, aecpc->scSampFreq) == -1) { |
| 213 aecpc->lastError = AEC_UNSPECIFIED_ERROR; | 210 return AEC_UNSPECIFIED_ERROR; |
| 214 return -1; | |
| 215 } | 211 } |
| 216 | 212 |
| 217 WebRtc_InitBuffer(aecpc->far_pre_buf); | 213 WebRtc_InitBuffer(aecpc->far_pre_buf); |
| 218 WebRtc_MoveReadPtr(aecpc->far_pre_buf, -PART_LEN); // Start overlap. | 214 WebRtc_MoveReadPtr(aecpc->far_pre_buf, -PART_LEN); // Start overlap. |
| 219 | 215 |
| 220 aecpc->initFlag = initCheck; // indicates that initialization has been done | 216 aecpc->initFlag = initCheck; // indicates that initialization has been done |
| 221 | 217 |
| 222 if (aecpc->sampFreq == 32000 || aecpc->sampFreq == 48000) { | 218 if (aecpc->sampFreq == 32000 || aecpc->sampFreq == 48000) { |
| 223 aecpc->splitSampFreq = 16000; | 219 aecpc->splitSampFreq = 16000; |
| 224 } else { | 220 } else { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 254 | 250 |
| 255 aecpc->farend_started = 0; | 251 aecpc->farend_started = 0; |
| 256 | 252 |
| 257 // Default settings. | 253 // Default settings. |
| 258 aecConfig.nlpMode = kAecNlpModerate; | 254 aecConfig.nlpMode = kAecNlpModerate; |
| 259 aecConfig.skewMode = kAecFalse; | 255 aecConfig.skewMode = kAecFalse; |
| 260 aecConfig.metricsMode = kAecFalse; | 256 aecConfig.metricsMode = kAecFalse; |
| 261 aecConfig.delay_logging = kAecFalse; | 257 aecConfig.delay_logging = kAecFalse; |
| 262 | 258 |
| 263 if (WebRtcAec_set_config(aecpc, aecConfig) == -1) { | 259 if (WebRtcAec_set_config(aecpc, aecConfig) == -1) { |
| 264 aecpc->lastError = AEC_UNSPECIFIED_ERROR; | 260 return AEC_UNSPECIFIED_ERROR; |
| 265 return -1; | |
| 266 } | 261 } |
| 267 | 262 |
| 268 return 0; | 263 return 0; |
| 269 } | 264 } |
| 270 | 265 |
| 266 // Returns any error that is caused when buffering the | |
| 267 // farend signal. | |
| 268 int32_t WebRtcAec_GetBufferFarendError(void* aecInst, | |
| 269 const float* farend, | |
| 270 size_t nrOfSamples) { | |
| 271 Aec* aecpc = aecInst; | |
| 272 | |
| 273 if (farend == NULL) | |
| 274 return AEC_NULL_POINTER_ERROR; | |
| 275 | |
| 276 if (aecpc->initFlag != initCheck) | |
| 277 return AEC_UNINITIALIZED_ERROR; | |
| 278 | |
| 279 // number of samples == 160 for SWB input | |
| 280 if (nrOfSamples != 80 && nrOfSamples != 160) | |
| 281 return AEC_BAD_PARAMETER_ERROR; | |
| 282 | |
| 283 return 0; | |
| 284 } | |
| 285 | |
| 271 // only buffer L band for farend | 286 // only buffer L band for farend |
| 272 int32_t WebRtcAec_BufferFarend(void* aecInst, | 287 int32_t WebRtcAec_BufferFarend(void* aecInst, |
| 273 const float* farend, | 288 const float* farend, |
| 274 size_t nrOfSamples) { | 289 size_t nrOfSamples) { |
| 275 Aec* aecpc = aecInst; | 290 Aec* aecpc = aecInst; |
| 276 size_t newNrOfSamples = nrOfSamples; | 291 size_t newNrOfSamples = nrOfSamples; |
| 277 float new_farend[MAX_RESAMP_LEN]; | 292 float new_farend[MAX_RESAMP_LEN]; |
| 278 const float* farend_ptr = farend; | 293 const float* farend_ptr = farend; |
| 294 int32_t error_code; | |
| 279 | 295 |
| 280 if (farend == NULL) { | 296 // Get any error caused by buffering the farend signal. |
| 281 aecpc->lastError = AEC_NULL_POINTER_ERROR; | 297 error_code = WebRtcAec_GetBufferFarendError(aecInst, farend, nrOfSamples); |
| 282 return -1; | |
| 283 } | |
| 284 | 298 |
| 285 if (aecpc->initFlag != initCheck) { | 299 if (error_code != 0) |
| 286 aecpc->lastError = AEC_UNINITIALIZED_ERROR; | 300 return error_code; |
| 287 return -1; | |
| 288 } | |
| 289 | 301 |
| 290 // number of samples == 160 for SWB input | |
| 291 if (nrOfSamples != 80 && nrOfSamples != 160) { | |
| 292 aecpc->lastError = AEC_BAD_PARAMETER_ERROR; | |
| 293 return -1; | |
| 294 } | |
| 295 | 302 |
| 296 if (aecpc->skewMode == kAecTrue && aecpc->resample == kAecTrue) { | 303 if (aecpc->skewMode == kAecTrue && aecpc->resample == kAecTrue) { |
| 297 // Resample and get a new number of samples | 304 // Resample and get a new number of samples |
| 298 WebRtcAec_ResampleLinear(aecpc->resampler, | 305 WebRtcAec_ResampleLinear(aecpc->resampler, |
| 299 farend, | 306 farend, |
| 300 nrOfSamples, | 307 nrOfSamples, |
| 301 aecpc->skew, | 308 aecpc->skew, |
| 302 new_farend, | 309 new_farend, |
| 303 &newNrOfSamples); | 310 &newNrOfSamples); |
| 304 farend_ptr = new_farend; | 311 farend_ptr = new_farend; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 const float* const* nearend, | 343 const float* const* nearend, |
| 337 size_t num_bands, | 344 size_t num_bands, |
| 338 float* const* out, | 345 float* const* out, |
| 339 size_t nrOfSamples, | 346 size_t nrOfSamples, |
| 340 int16_t msInSndCardBuf, | 347 int16_t msInSndCardBuf, |
| 341 int32_t skew) { | 348 int32_t skew) { |
| 342 Aec* aecpc = aecInst; | 349 Aec* aecpc = aecInst; |
| 343 int32_t retVal = 0; | 350 int32_t retVal = 0; |
| 344 | 351 |
| 345 if (out == NULL) { | 352 if (out == NULL) { |
| 346 aecpc->lastError = AEC_NULL_POINTER_ERROR; | 353 return AEC_NULL_POINTER_ERROR; |
| 347 return -1; | |
| 348 } | 354 } |
| 349 | 355 |
| 350 if (aecpc->initFlag != initCheck) { | 356 if (aecpc->initFlag != initCheck) { |
| 351 aecpc->lastError = AEC_UNINITIALIZED_ERROR; | 357 return AEC_UNINITIALIZED_ERROR; |
| 352 return -1; | |
| 353 } | 358 } |
| 354 | 359 |
| 355 // number of samples == 160 for SWB input | 360 // number of samples == 160 for SWB input |
| 356 if (nrOfSamples != 80 && nrOfSamples != 160) { | 361 if (nrOfSamples != 80 && nrOfSamples != 160) { |
| 357 aecpc->lastError = AEC_BAD_PARAMETER_ERROR; | 362 return AEC_BAD_PARAMETER_ERROR; |
| 358 return -1; | |
| 359 } | 363 } |
| 360 | 364 |
| 361 if (msInSndCardBuf < 0) { | 365 if (msInSndCardBuf < 0) { |
| 362 msInSndCardBuf = 0; | 366 msInSndCardBuf = 0; |
| 363 aecpc->lastError = AEC_BAD_PARAMETER_WARNING; | 367 retVal = AEC_BAD_PARAMETER_WARNING; |
| 364 retVal = -1; | |
| 365 } else if (msInSndCardBuf > kMaxTrustedDelayMs) { | 368 } else if (msInSndCardBuf > kMaxTrustedDelayMs) { |
| 366 // The clamping is now done in ProcessExtended/Normal(). | 369 // The clamping is now done in ProcessExtended/Normal(). |
| 367 aecpc->lastError = AEC_BAD_PARAMETER_WARNING; | 370 retVal = AEC_BAD_PARAMETER_WARNING; |
| 368 retVal = -1; | |
| 369 } | 371 } |
| 370 | 372 |
| 371 // This returns the value of aec->extended_filter_enabled. | 373 // This returns the value of aec->extended_filter_enabled. |
| 372 if (WebRtcAec_extended_filter_enabled(aecpc->aec)) { | 374 if (WebRtcAec_extended_filter_enabled(aecpc->aec)) { |
| 373 ProcessExtended(aecpc, | 375 ProcessExtended(aecpc, |
| 374 nearend, | 376 nearend, |
| 375 num_bands, | 377 num_bands, |
| 376 out, | 378 out, |
| 377 nrOfSamples, | 379 nrOfSamples, |
| 378 msInSndCardBuf, | 380 msInSndCardBuf, |
| 379 skew); | 381 skew); |
| 380 } else { | 382 } else { |
| 381 if (ProcessNormal(aecpc, | 383 retVal = ProcessNormal(aecpc, |
| 382 nearend, | 384 nearend, |
| 383 num_bands, | 385 num_bands, |
| 384 out, | 386 out, |
| 385 nrOfSamples, | 387 nrOfSamples, |
| 386 msInSndCardBuf, | 388 msInSndCardBuf, |
| 387 skew) != 0) { | 389 skew); |
| 388 retVal = -1; | |
| 389 } | |
| 390 } | 390 } |
| 391 | 391 |
| 392 #ifdef WEBRTC_AEC_DEBUG_DUMP | 392 #ifdef WEBRTC_AEC_DEBUG_DUMP |
| 393 { | 393 { |
| 394 int16_t far_buf_size_ms = (int16_t)(WebRtcAec_system_delay(aecpc->aec) / | 394 int16_t far_buf_size_ms = (int16_t)(WebRtcAec_system_delay(aecpc->aec) / |
| 395 (sampMsNb * aecpc->rate_factor)); | 395 (sampMsNb * aecpc->rate_factor)); |
| 396 (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); | 396 (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); |
| 397 (void)fwrite( | 397 (void)fwrite( |
| 398 &aecpc->knownDelay, sizeof(aecpc->knownDelay), 1, aecpc->delayFile); | 398 &aecpc->knownDelay, sizeof(aecpc->knownDelay), 1, aecpc->delayFile); |
| 399 } | 399 } |
| 400 #endif | 400 #endif |
| 401 | 401 |
| 402 return retVal; | 402 return retVal; |
| 403 } | 403 } |
| 404 | 404 |
| 405 int WebRtcAec_set_config(void* handle, AecConfig config) { | 405 int WebRtcAec_set_config(void* handle, AecConfig config) { |
| 406 Aec* self = (Aec*)handle; | 406 Aec* self = (Aec*)handle; |
| 407 if (self->initFlag != initCheck) { | 407 if (self->initFlag != initCheck) { |
| 408 self->lastError = AEC_UNINITIALIZED_ERROR; | 408 // Due to the initialization scheme the indirect |
| 409 return -1; | 409 // reporting of this error code cannot yet be changed to be |
| 410 // direct. | |
| 411 return AEC_UNINITIALIZED_ERROR; | |
| 410 } | 412 } |
| 411 | 413 |
| 412 if (config.skewMode != kAecFalse && config.skewMode != kAecTrue) { | 414 if (config.skewMode != kAecFalse && config.skewMode != kAecTrue) { |
| 413 self->lastError = AEC_BAD_PARAMETER_ERROR; | 415 // Due to the initialization scheme the indirect |
| 414 return -1; | 416 // reporting of this error code cannot yet be changed to be |
| 417 // direct. | |
| 418 return AEC_BAD_PARAMETER_ERROR; | |
| 415 } | 419 } |
| 416 self->skewMode = config.skewMode; | 420 self->skewMode = config.skewMode; |
| 417 | 421 |
| 418 if (config.nlpMode != kAecNlpConservative && | 422 if (config.nlpMode != kAecNlpConservative && |
| 419 config.nlpMode != kAecNlpModerate && | 423 config.nlpMode != kAecNlpModerate && |
| 420 config.nlpMode != kAecNlpAggressive) { | 424 config.nlpMode != kAecNlpAggressive) { |
| 421 self->lastError = AEC_BAD_PARAMETER_ERROR; | 425 // Due to the initialization scheme the indirect |
| 422 return -1; | 426 // reporting of this error code cannot yet be changed to be |
| 427 // direct. | |
| 428 return AEC_BAD_PARAMETER_ERROR; | |
| 423 } | 429 } |
| 424 | 430 |
| 425 if (config.metricsMode != kAecFalse && config.metricsMode != kAecTrue) { | 431 if (config.metricsMode != kAecFalse && config.metricsMode != kAecTrue) { |
| 426 self->lastError = AEC_BAD_PARAMETER_ERROR; | 432 // Due to the initialization scheme the indirect |
| 427 return -1; | 433 // reporting of this error code cannot yet be changed to be |
| 434 // direct. | |
| 435 return AEC_BAD_PARAMETER_ERROR; | |
| 428 } | 436 } |
| 429 | 437 |
| 430 if (config.delay_logging != kAecFalse && config.delay_logging != kAecTrue) { | 438 if (config.delay_logging != kAecFalse && config.delay_logging != kAecTrue) { |
| 431 self->lastError = AEC_BAD_PARAMETER_ERROR; | 439 // Due to the initialization scheme the indirect |
| 432 return -1; | 440 // reporting of this error code cannot yet be changed to be |
| 441 // direct. | |
| 442 return AEC_BAD_PARAMETER_ERROR; | |
| 433 } | 443 } |
| 434 | 444 |
| 435 WebRtcAec_SetConfigCore( | 445 WebRtcAec_SetConfigCore( |
| 436 self->aec, config.nlpMode, config.metricsMode, config.delay_logging); | 446 self->aec, config.nlpMode, config.metricsMode, config.delay_logging); |
| 437 return 0; | 447 return 0; |
| 438 } | 448 } |
| 439 | 449 |
| 440 int WebRtcAec_get_echo_status(void* handle, int* status) { | 450 int WebRtcAec_get_echo_status(void* handle, int* status) { |
| 441 Aec* self = (Aec*)handle; | 451 Aec* self = (Aec*)handle; |
| 442 if (status == NULL) { | 452 if (status == NULL) { |
| 443 self->lastError = AEC_NULL_POINTER_ERROR; | 453 return AEC_NULL_POINTER_ERROR; |
| 444 return -1; | |
| 445 } | 454 } |
| 446 if (self->initFlag != initCheck) { | 455 if (self->initFlag != initCheck) { |
| 447 self->lastError = AEC_UNINITIALIZED_ERROR; | 456 return AEC_UNINITIALIZED_ERROR; |
| 448 return -1; | |
| 449 } | 457 } |
| 450 | 458 |
| 451 *status = WebRtcAec_echo_state(self->aec); | 459 *status = WebRtcAec_echo_state(self->aec); |
| 452 | 460 |
| 453 return 0; | 461 return 0; |
| 454 } | 462 } |
| 455 | 463 |
| 456 int WebRtcAec_GetMetrics(void* handle, AecMetrics* metrics) { | 464 int WebRtcAec_GetMetrics(void* handle, AecMetrics* metrics) { |
| 457 const float kUpWeight = 0.7f; | 465 const float kUpWeight = 0.7f; |
| 458 float dtmp; | 466 float dtmp; |
| 459 int stmp; | 467 int stmp; |
| 460 Aec* self = (Aec*)handle; | 468 Aec* self = (Aec*)handle; |
| 461 Stats erl; | 469 Stats erl; |
| 462 Stats erle; | 470 Stats erle; |
| 463 Stats a_nlp; | 471 Stats a_nlp; |
| 464 | 472 |
| 465 if (handle == NULL) { | 473 if (handle == NULL) { |
| 466 return -1; | 474 return -1; |
| 467 } | 475 } |
| 468 if (metrics == NULL) { | 476 if (metrics == NULL) { |
| 469 self->lastError = AEC_NULL_POINTER_ERROR; | 477 return AEC_NULL_POINTER_ERROR; |
| 470 return -1; | |
| 471 } | 478 } |
| 472 if (self->initFlag != initCheck) { | 479 if (self->initFlag != initCheck) { |
| 473 self->lastError = AEC_UNINITIALIZED_ERROR; | 480 return AEC_UNINITIALIZED_ERROR; |
| 474 return -1; | |
| 475 } | 481 } |
| 476 | 482 |
| 477 WebRtcAec_GetEchoStats(self->aec, &erl, &erle, &a_nlp); | 483 WebRtcAec_GetEchoStats(self->aec, &erl, &erle, &a_nlp); |
| 478 | 484 |
| 479 // ERL | 485 // ERL |
| 480 metrics->erl.instant = (int)erl.instant; | 486 metrics->erl.instant = (int)erl.instant; |
| 481 | 487 |
| 482 if ((erl.himean > kOffsetLevel) && (erl.average > kOffsetLevel)) { | 488 if ((erl.himean > kOffsetLevel) && (erl.average > kOffsetLevel)) { |
| 483 // Use a mix between regular average and upper part average. | 489 // Use a mix between regular average and upper part average. |
| 484 dtmp = kUpWeight * erl.himean + (1 - kUpWeight) * erl.average; | 490 dtmp = kUpWeight * erl.himean + (1 - kUpWeight) * erl.average; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 | 555 |
| 550 return 0; | 556 return 0; |
| 551 } | 557 } |
| 552 | 558 |
| 553 int WebRtcAec_GetDelayMetrics(void* handle, | 559 int WebRtcAec_GetDelayMetrics(void* handle, |
| 554 int* median, | 560 int* median, |
| 555 int* std, | 561 int* std, |
| 556 float* fraction_poor_delays) { | 562 float* fraction_poor_delays) { |
| 557 Aec* self = handle; | 563 Aec* self = handle; |
| 558 if (median == NULL) { | 564 if (median == NULL) { |
| 559 self->lastError = AEC_NULL_POINTER_ERROR; | 565 return AEC_NULL_POINTER_ERROR; |
| 560 return -1; | |
| 561 } | 566 } |
| 562 if (std == NULL) { | 567 if (std == NULL) { |
| 563 self->lastError = AEC_NULL_POINTER_ERROR; | 568 return AEC_NULL_POINTER_ERROR; |
| 564 return -1; | |
| 565 } | 569 } |
| 566 if (self->initFlag != initCheck) { | 570 if (self->initFlag != initCheck) { |
| 567 self->lastError = AEC_UNINITIALIZED_ERROR; | 571 return AEC_UNINITIALIZED_ERROR; |
| 568 return -1; | |
| 569 } | 572 } |
| 570 if (WebRtcAec_GetDelayMetricsCore(self->aec, median, std, | 573 if (WebRtcAec_GetDelayMetricsCore(self->aec, median, std, |
| 571 fraction_poor_delays) == | 574 fraction_poor_delays) == |
| 572 -1) { | 575 -1) { |
| 573 // Logging disabled. | 576 // Logging disabled. |
| 574 self->lastError = AEC_UNSUPPORTED_FUNCTION_ERROR; | 577 return AEC_UNSUPPORTED_FUNCTION_ERROR; |
| 575 return -1; | |
| 576 } | 578 } |
| 577 | 579 |
| 578 return 0; | 580 return 0; |
| 579 } | 581 } |
| 580 | 582 |
| 581 int32_t WebRtcAec_get_error_code(void* aecInst) { | |
| 582 Aec* aecpc = aecInst; | |
| 583 return aecpc->lastError; | |
| 584 } | |
| 585 | 583 |
| 586 AecCore* WebRtcAec_aec_core(void* handle) { | 584 AecCore* WebRtcAec_aec_core(void* handle) { |
| 587 if (!handle) { | 585 if (!handle) { |
| 588 return NULL; | 586 return NULL; |
| 589 } | 587 } |
| 590 return ((Aec*)handle)->aec; | 588 return ((Aec*)handle)->aec; |
| 591 } | 589 } |
| 592 | 590 |
| 593 static int ProcessNormal(Aec* aecpc, | 591 static int ProcessNormal(Aec* aecpc, |
| 594 const float* const* nearend, | 592 const float* const* nearend, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 610 msInSndCardBuf += 10; | 608 msInSndCardBuf += 10; |
| 611 aecpc->msInSndCardBuf = msInSndCardBuf; | 609 aecpc->msInSndCardBuf = msInSndCardBuf; |
| 612 | 610 |
| 613 if (aecpc->skewMode == kAecTrue) { | 611 if (aecpc->skewMode == kAecTrue) { |
| 614 if (aecpc->skewFrCtr < 25) { | 612 if (aecpc->skewFrCtr < 25) { |
| 615 aecpc->skewFrCtr++; | 613 aecpc->skewFrCtr++; |
| 616 } else { | 614 } else { |
| 617 retVal = WebRtcAec_GetSkew(aecpc->resampler, skew, &aecpc->skew); | 615 retVal = WebRtcAec_GetSkew(aecpc->resampler, skew, &aecpc->skew); |
| 618 if (retVal == -1) { | 616 if (retVal == -1) { |
| 619 aecpc->skew = 0; | 617 aecpc->skew = 0; |
| 620 aecpc->lastError = AEC_BAD_PARAMETER_WARNING; | 618 retVal = AEC_BAD_PARAMETER_WARNING; |
| 621 } | 619 } |
| 622 | 620 |
| 623 aecpc->skew /= aecpc->sampFactor * nrOfSamples; | 621 aecpc->skew /= aecpc->sampFactor * nrOfSamples; |
| 624 | 622 |
| 625 if (aecpc->skew < 1.0e-3 && aecpc->skew > -1.0e-3) { | 623 if (aecpc->skew < 1.0e-3 && aecpc->skew > -1.0e-3) { |
| 626 aecpc->resample = kAecFalse; | 624 aecpc->resample = kAecFalse; |
| 627 } else { | 625 } else { |
| 628 aecpc->resample = kAecTrue; | 626 aecpc->resample = kAecTrue; |
| 629 } | 627 } |
| 630 | 628 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 914 } | 912 } |
| 915 } else { | 913 } else { |
| 916 self->timeForDelayChange = 0; | 914 self->timeForDelayChange = 0; |
| 917 } | 915 } |
| 918 self->lastDelayDiff = delay_difference; | 916 self->lastDelayDiff = delay_difference; |
| 919 | 917 |
| 920 if (self->timeForDelayChange > 25) { | 918 if (self->timeForDelayChange > 25) { |
| 921 self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0); | 919 self->knownDelay = WEBRTC_SPL_MAX((int)self->filtDelay - 256, 0); |
| 922 } | 920 } |
| 923 } | 921 } |
| OLD | NEW |