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