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 |
11 /* | 11 /* |
12 * The core AEC algorithm, which is presented with time-aligned signals. | 12 * The core AEC algorithm, which is presented with time-aligned signals. |
13 */ | 13 */ |
14 | 14 |
15 #include "webrtc/modules/audio_processing/aec/aec_core.h" | 15 #include "webrtc/modules/audio_processing/aec/aec_core.h" |
16 | 16 |
17 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
18 #include <stdio.h> | |
19 #endif | |
20 | |
21 #include <algorithm> | 17 #include <algorithm> |
22 #include <assert.h> | 18 #include <assert.h> |
23 #include <math.h> | 19 #include <math.h> |
24 #include <stddef.h> // size_t | 20 #include <stddef.h> // size_t |
25 #include <stdlib.h> | 21 #include <stdlib.h> |
26 #include <string.h> | 22 #include <string.h> |
27 | 23 |
28 #include "webrtc/base/checks.h" | 24 #include "webrtc/base/checks.h" |
29 extern "C" { | 25 extern "C" { |
30 #include "webrtc/common_audio/ring_buffer.h" | 26 #include "webrtc/common_audio/ring_buffer.h" |
31 } | 27 } |
32 #include "webrtc/base/checks.h" | 28 #include "webrtc/base/checks.h" |
33 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 29 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
34 #include "webrtc/modules/audio_processing/aec/aec_common.h" | 30 #include "webrtc/modules/audio_processing/aec/aec_common.h" |
35 #include "webrtc/modules/audio_processing/aec/aec_core_internal.h" | 31 #include "webrtc/modules/audio_processing/aec/aec_core_internal.h" |
36 #include "webrtc/modules/audio_processing/aec/aec_rdft.h" | 32 #include "webrtc/modules/audio_processing/aec/aec_rdft.h" |
37 #include "webrtc/modules/audio_processing/logging/aec_logging.h" | |
38 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" | 33 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" |
39 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" | 34 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" |
40 #include "webrtc/typedefs.h" | 35 #include "webrtc/typedefs.h" |
41 | 36 |
42 namespace webrtc { | 37 namespace webrtc { |
43 | 38 |
44 // Buffer size (samples) | 39 // Buffer size (samples) |
45 static const size_t kBufSizePartitions = 250; // 1 second of audio in 16 kHz. | 40 static const size_t kBufSizePartitions = 250; // 1 second of audio in 16 kHz. |
46 | 41 |
47 // Metrics | 42 // Metrics |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 static const float kExtendedMinOverDrive[3] = {3.0f, 6.0f, 15.0f}; | 121 static const float kExtendedMinOverDrive[3] = {3.0f, 6.0f, 15.0f}; |
127 static const float kNormalMinOverDrive[3] = {1.0f, 2.0f, 5.0f}; | 122 static const float kNormalMinOverDrive[3] = {1.0f, 2.0f, 5.0f}; |
128 const float WebRtcAec_kExtendedSmoothingCoefficients[2][2] = {{0.9f, 0.1f}, | 123 const float WebRtcAec_kExtendedSmoothingCoefficients[2][2] = {{0.9f, 0.1f}, |
129 {0.92f, 0.08f}}; | 124 {0.92f, 0.08f}}; |
130 const float WebRtcAec_kNormalSmoothingCoefficients[2][2] = {{0.9f, 0.1f}, | 125 const float WebRtcAec_kNormalSmoothingCoefficients[2][2] = {{0.9f, 0.1f}, |
131 {0.93f, 0.07f}}; | 126 {0.93f, 0.07f}}; |
132 | 127 |
133 // Number of partitions forming the NLP's "preferred" bands. | 128 // Number of partitions forming the NLP's "preferred" bands. |
134 enum { kPrefBandSize = 24 }; | 129 enum { kPrefBandSize = 24 }; |
135 | 130 |
136 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
137 extern int webrtc_aec_instance_count; | |
138 #endif | |
139 | |
140 WebRtcAecFilterFar WebRtcAec_FilterFar; | 131 WebRtcAecFilterFar WebRtcAec_FilterFar; |
141 WebRtcAecScaleErrorSignal WebRtcAec_ScaleErrorSignal; | 132 WebRtcAecScaleErrorSignal WebRtcAec_ScaleErrorSignal; |
142 WebRtcAecFilterAdaptation WebRtcAec_FilterAdaptation; | 133 WebRtcAecFilterAdaptation WebRtcAec_FilterAdaptation; |
143 WebRtcAecOverdriveAndSuppress WebRtcAec_OverdriveAndSuppress; | 134 WebRtcAecOverdriveAndSuppress WebRtcAec_OverdriveAndSuppress; |
144 WebRtcAecComfortNoise WebRtcAec_ComfortNoise; | 135 WebRtcAecComfortNoise WebRtcAec_ComfortNoise; |
145 WebRtcAecSubBandCoherence WebRtcAec_SubbandCoherence; | 136 WebRtcAecSubBandCoherence WebRtcAec_SubbandCoherence; |
146 WebRtcAecStoreAsComplex WebRtcAec_StoreAsComplex; | 137 WebRtcAecStoreAsComplex WebRtcAec_StoreAsComplex; |
147 WebRtcAecPartitionDelay WebRtcAec_PartitionDelay; | 138 WebRtcAecPartitionDelay WebRtcAec_PartitionDelay; |
148 WebRtcAecWindowData WebRtcAec_WindowData; | 139 WebRtcAecWindowData WebRtcAec_WindowData; |
149 | 140 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 float DivergentFilterFraction::GetLatestFraction() const { | 191 float DivergentFilterFraction::GetLatestFraction() const { |
201 return fraction_; | 192 return fraction_; |
202 } | 193 } |
203 | 194 |
204 void DivergentFilterFraction::Clear() { | 195 void DivergentFilterFraction::Clear() { |
205 count_ = 0; | 196 count_ = 0; |
206 occurrence_ = 0; | 197 occurrence_ = 0; |
207 } | 198 } |
208 | 199 |
209 // TODO(minyue): Moving some initialization from WebRtcAec_CreateAec() to ctor. | 200 // TODO(minyue): Moving some initialization from WebRtcAec_CreateAec() to ctor. |
210 AecCore::AecCore() = default; | 201 AecCore::AecCore(int instance_index) |
| 202 : data_dumper(new ApmDataDumper(instance_index)) {} |
| 203 |
| 204 AecCore::~AecCore() {} |
211 | 205 |
212 static int CmpFloat(const void* a, const void* b) { | 206 static int CmpFloat(const void* a, const void* b) { |
213 const float* da = (const float*)a; | 207 const float* da = (const float*)a; |
214 const float* db = (const float*)b; | 208 const float* db = (const float*)b; |
215 | 209 |
216 return (*da > *db) - (*da < *db); | 210 return (*da > *db) - (*da < *db); |
217 } | 211 } |
218 | 212 |
219 static void FilterFar(int num_partitions, | 213 static void FilterFar(int num_partitions, |
220 int x_fft_buf_block_pos, | 214 int x_fft_buf_block_pos, |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 } | 1256 } |
1263 WebRtc_ReadBuffer(aec->nearFrBuf, reinterpret_cast<void**>(&nearend_ptr), | 1257 WebRtc_ReadBuffer(aec->nearFrBuf, reinterpret_cast<void**>(&nearend_ptr), |
1264 nearend, PART_LEN); | 1258 nearend, PART_LEN); |
1265 memcpy(aec->dBuf + PART_LEN, nearend_ptr, sizeof(nearend)); | 1259 memcpy(aec->dBuf + PART_LEN, nearend_ptr, sizeof(nearend)); |
1266 | 1260 |
1267 // We should always have at least one element stored in |far_buf|. | 1261 // We should always have at least one element stored in |far_buf|. |
1268 assert(WebRtc_available_read(aec->far_time_buf) > 0); | 1262 assert(WebRtc_available_read(aec->far_time_buf) > 0); |
1269 WebRtc_ReadBuffer(aec->far_time_buf, reinterpret_cast<void**>(&farend_ptr), | 1263 WebRtc_ReadBuffer(aec->far_time_buf, reinterpret_cast<void**>(&farend_ptr), |
1270 farend, 1); | 1264 farend, 1); |
1271 | 1265 |
1272 #ifdef WEBRTC_AEC_DEBUG_DUMP | 1266 aec->data_dumper->DumpWav("aec_far", PART_LEN, &farend_ptr[PART_LEN], |
1273 { | 1267 std::min(aec->sampFreq, 16000), 1); |
1274 // TODO(minyue): |farend_ptr| starts from buffered samples. This will be | 1268 aec->data_dumper->DumpWav("aec_near", PART_LEN, nearend_ptr, |
1275 // modified when |aec->far_time_buf| is revised. | 1269 std::min(aec->sampFreq, 16000), 1); |
1276 RTC_AEC_DEBUG_WAV_WRITE(aec->farFile, &farend_ptr[PART_LEN], PART_LEN); | |
1277 | |
1278 RTC_AEC_DEBUG_WAV_WRITE(aec->nearFile, nearend_ptr, PART_LEN); | |
1279 } | |
1280 #endif | |
1281 | 1270 |
1282 if (aec->metricsMode == 1) { | 1271 if (aec->metricsMode == 1) { |
1283 // Update power levels | 1272 // Update power levels |
1284 UpdateLevel(&aec->farlevel, | 1273 UpdateLevel(&aec->farlevel, |
1285 CalculatePower(&farend_ptr[PART_LEN], PART_LEN)); | 1274 CalculatePower(&farend_ptr[PART_LEN], PART_LEN)); |
1286 UpdateLevel(&aec->nearlevel, CalculatePower(nearend_ptr, PART_LEN)); | 1275 UpdateLevel(&aec->nearlevel, CalculatePower(nearend_ptr, PART_LEN)); |
1287 } | 1276 } |
1288 | 1277 |
1289 // Convert far-end signal to the frequency domain. | 1278 // Convert far-end signal to the frequency domain. |
1290 memcpy(fft, farend_ptr, sizeof(float) * PART_LEN2); | 1279 memcpy(fft, farend_ptr, sizeof(float) * PART_LEN2); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 } | 1359 } |
1371 } | 1360 } |
1372 | 1361 |
1373 // Perform echo subtraction. | 1362 // Perform echo subtraction. |
1374 EchoSubtraction(aec->num_partitions, aec->extended_filter_enabled, | 1363 EchoSubtraction(aec->num_partitions, aec->extended_filter_enabled, |
1375 &aec->extreme_filter_divergence, aec->filter_step_size, | 1364 &aec->extreme_filter_divergence, aec->filter_step_size, |
1376 aec->error_threshold, &x_fft[0][0], &aec->xfBufBlockPos, | 1365 aec->error_threshold, &x_fft[0][0], &aec->xfBufBlockPos, |
1377 aec->xfBuf, nearend_ptr, aec->xPow, aec->wfBuf, | 1366 aec->xfBuf, nearend_ptr, aec->xPow, aec->wfBuf, |
1378 echo_subtractor_output); | 1367 echo_subtractor_output); |
1379 | 1368 |
1380 RTC_AEC_DEBUG_WAV_WRITE(aec->outLinearFile, echo_subtractor_output, PART_LEN); | 1369 aec->data_dumper->DumpWav("aec_out_linear", PART_LEN, echo_subtractor_output, |
| 1370 std::min(aec->sampFreq, 16000), 1); |
1381 | 1371 |
1382 if (aec->metricsMode == 1) { | 1372 if (aec->metricsMode == 1) { |
1383 UpdateLevel(&aec->linoutlevel, | 1373 UpdateLevel(&aec->linoutlevel, |
1384 CalculatePower(echo_subtractor_output, PART_LEN)); | 1374 CalculatePower(echo_subtractor_output, PART_LEN)); |
1385 } | 1375 } |
1386 | 1376 |
1387 // Perform echo suppression. | 1377 // Perform echo suppression. |
1388 EchoSuppression(aec, farend_ptr, echo_subtractor_output, output, outputH_ptr); | 1378 EchoSuppression(aec, farend_ptr, echo_subtractor_output, output, outputH_ptr); |
1389 | 1379 |
1390 if (aec->metricsMode == 1) { | 1380 if (aec->metricsMode == 1) { |
1391 UpdateLevel(&aec->nlpoutlevel, CalculatePower(output, PART_LEN)); | 1381 UpdateLevel(&aec->nlpoutlevel, CalculatePower(output, PART_LEN)); |
1392 UpdateMetrics(aec); | 1382 UpdateMetrics(aec); |
1393 } | 1383 } |
1394 | 1384 |
1395 // Store the output block. | 1385 // Store the output block. |
1396 WebRtc_WriteBuffer(aec->outFrBuf, output, PART_LEN); | 1386 WebRtc_WriteBuffer(aec->outFrBuf, output, PART_LEN); |
1397 // For high bands | 1387 // For high bands |
1398 for (i = 0; i < aec->num_bands - 1; ++i) { | 1388 for (i = 0; i < aec->num_bands - 1; ++i) { |
1399 WebRtc_WriteBuffer(aec->outFrBufH[i], outputH[i], PART_LEN); | 1389 WebRtc_WriteBuffer(aec->outFrBufH[i], outputH[i], PART_LEN); |
1400 } | 1390 } |
1401 | 1391 |
1402 RTC_AEC_DEBUG_WAV_WRITE(aec->outFile, output, PART_LEN); | 1392 aec->data_dumper->DumpWav("aec_out", PART_LEN, output, |
| 1393 std::min(aec->sampFreq, 16000), 1); |
1403 } | 1394 } |
1404 | 1395 |
1405 AecCore* WebRtcAec_CreateAec() { | 1396 AecCore* WebRtcAec_CreateAec(int instance_count) { |
1406 int i; | 1397 int i; |
1407 AecCore* aec = new AecCore; | 1398 AecCore* aec = new AecCore(instance_count); |
| 1399 |
1408 if (!aec) { | 1400 if (!aec) { |
1409 return NULL; | 1401 return NULL; |
1410 } | 1402 } |
1411 | 1403 |
1412 aec->nearFrBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(float)); | 1404 aec->nearFrBuf = WebRtc_CreateBuffer(FRAME_LEN + PART_LEN, sizeof(float)); |
1413 if (!aec->nearFrBuf) { | 1405 if (!aec->nearFrBuf) { |
1414 WebRtcAec_FreeAec(aec); | 1406 WebRtcAec_FreeAec(aec); |
1415 return NULL; | 1407 return NULL; |
1416 } | 1408 } |
1417 | 1409 |
(...skipping 23 matching lines...) Expand all Loading... |
1441 // supposed to contain |PART_LEN2| samples with an overlap of |PART_LEN| | 1433 // supposed to contain |PART_LEN2| samples with an overlap of |PART_LEN| |
1442 // samples from the last frame. | 1434 // samples from the last frame. |
1443 // TODO(minyue): reduce |far_time_buf| to non-overlapped |PART_LEN| samples. | 1435 // TODO(minyue): reduce |far_time_buf| to non-overlapped |PART_LEN| samples. |
1444 aec->far_time_buf = | 1436 aec->far_time_buf = |
1445 WebRtc_CreateBuffer(kBufSizePartitions, sizeof(float) * PART_LEN2); | 1437 WebRtc_CreateBuffer(kBufSizePartitions, sizeof(float) * PART_LEN2); |
1446 if (!aec->far_time_buf) { | 1438 if (!aec->far_time_buf) { |
1447 WebRtcAec_FreeAec(aec); | 1439 WebRtcAec_FreeAec(aec); |
1448 return NULL; | 1440 return NULL; |
1449 } | 1441 } |
1450 | 1442 |
1451 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
1452 aec->instance_index = webrtc_aec_instance_count; | |
1453 | |
1454 aec->farFile = aec->nearFile = aec->outFile = aec->outLinearFile = NULL; | |
1455 aec->debug_dump_count = 0; | |
1456 #endif | |
1457 aec->delay_estimator_farend = | 1443 aec->delay_estimator_farend = |
1458 WebRtc_CreateDelayEstimatorFarend(PART_LEN1, kHistorySizeBlocks); | 1444 WebRtc_CreateDelayEstimatorFarend(PART_LEN1, kHistorySizeBlocks); |
1459 if (aec->delay_estimator_farend == NULL) { | 1445 if (aec->delay_estimator_farend == NULL) { |
1460 WebRtcAec_FreeAec(aec); | 1446 WebRtcAec_FreeAec(aec); |
1461 return NULL; | 1447 return NULL; |
1462 } | 1448 } |
1463 // We create the delay_estimator with the same amount of maximum lookahead as | 1449 // We create the delay_estimator with the same amount of maximum lookahead as |
1464 // the delay history size (kHistorySizeBlocks) for symmetry reasons. | 1450 // the delay history size (kHistorySizeBlocks) for symmetry reasons. |
1465 aec->delay_estimator = WebRtc_CreateDelayEstimator( | 1451 aec->delay_estimator = WebRtc_CreateDelayEstimator( |
1466 aec->delay_estimator_farend, kHistorySizeBlocks); | 1452 aec->delay_estimator_farend, kHistorySizeBlocks); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 WebRtc_FreeBuffer(aec->nearFrBuf); | 1510 WebRtc_FreeBuffer(aec->nearFrBuf); |
1525 WebRtc_FreeBuffer(aec->outFrBuf); | 1511 WebRtc_FreeBuffer(aec->outFrBuf); |
1526 | 1512 |
1527 for (i = 0; i < NUM_HIGH_BANDS_MAX; ++i) { | 1513 for (i = 0; i < NUM_HIGH_BANDS_MAX; ++i) { |
1528 WebRtc_FreeBuffer(aec->nearFrBufH[i]); | 1514 WebRtc_FreeBuffer(aec->nearFrBufH[i]); |
1529 WebRtc_FreeBuffer(aec->outFrBufH[i]); | 1515 WebRtc_FreeBuffer(aec->outFrBufH[i]); |
1530 } | 1516 } |
1531 | 1517 |
1532 WebRtc_FreeBuffer(aec->far_time_buf); | 1518 WebRtc_FreeBuffer(aec->far_time_buf); |
1533 | 1519 |
1534 RTC_AEC_DEBUG_WAV_CLOSE(aec->farFile); | |
1535 RTC_AEC_DEBUG_WAV_CLOSE(aec->nearFile); | |
1536 RTC_AEC_DEBUG_WAV_CLOSE(aec->outFile); | |
1537 RTC_AEC_DEBUG_WAV_CLOSE(aec->outLinearFile); | |
1538 RTC_AEC_DEBUG_RAW_CLOSE(aec->e_fft_file); | |
1539 | |
1540 WebRtc_FreeDelayEstimator(aec->delay_estimator); | 1520 WebRtc_FreeDelayEstimator(aec->delay_estimator); |
1541 WebRtc_FreeDelayEstimatorFarend(aec->delay_estimator_farend); | 1521 WebRtc_FreeDelayEstimatorFarend(aec->delay_estimator_farend); |
1542 | 1522 |
1543 delete aec; | 1523 delete aec; |
1544 } | 1524 } |
1545 | 1525 |
1546 static void SetAdaptiveFilterStepSize(AecCore* aec) { | 1526 static void SetAdaptiveFilterStepSize(AecCore* aec) { |
1547 // Extended filter adaptation parameter. | 1527 // Extended filter adaptation parameter. |
1548 // TODO(ajm): No narrowband tuning yet. | 1528 // TODO(ajm): No narrowband tuning yet. |
1549 const float kExtendedMu = 0.4f; | 1529 const float kExtendedMu = 0.4f; |
(...skipping 24 matching lines...) Expand all Loading... |
1574 if (aec->sampFreq == 8000) { | 1554 if (aec->sampFreq == 8000) { |
1575 aec->error_threshold = 2e-6f; | 1555 aec->error_threshold = 2e-6f; |
1576 } else { | 1556 } else { |
1577 aec->error_threshold = 1.5e-6f; | 1557 aec->error_threshold = 1.5e-6f; |
1578 } | 1558 } |
1579 } | 1559 } |
1580 } | 1560 } |
1581 | 1561 |
1582 int WebRtcAec_InitAec(AecCore* aec, int sampFreq) { | 1562 int WebRtcAec_InitAec(AecCore* aec, int sampFreq) { |
1583 int i; | 1563 int i; |
| 1564 aec->data_dumper->InitiateNewSetOfRecordings(); |
1584 | 1565 |
1585 aec->sampFreq = sampFreq; | 1566 aec->sampFreq = sampFreq; |
1586 | 1567 |
1587 SetAdaptiveFilterStepSize(aec); | 1568 SetAdaptiveFilterStepSize(aec); |
1588 SetErrorThreshold(aec); | 1569 SetErrorThreshold(aec); |
1589 | 1570 |
1590 if (sampFreq == 8000) { | 1571 if (sampFreq == 8000) { |
1591 aec->num_bands = 1; | 1572 aec->num_bands = 1; |
1592 } else { | 1573 } else { |
1593 aec->num_bands = (size_t)(sampFreq / 16000); | 1574 aec->num_bands = (size_t)(sampFreq / 16000); |
1594 } | 1575 } |
1595 | 1576 |
1596 WebRtc_InitBuffer(aec->nearFrBuf); | 1577 WebRtc_InitBuffer(aec->nearFrBuf); |
1597 WebRtc_InitBuffer(aec->outFrBuf); | 1578 WebRtc_InitBuffer(aec->outFrBuf); |
1598 for (i = 0; i < NUM_HIGH_BANDS_MAX; ++i) { | 1579 for (i = 0; i < NUM_HIGH_BANDS_MAX; ++i) { |
1599 WebRtc_InitBuffer(aec->nearFrBufH[i]); | 1580 WebRtc_InitBuffer(aec->nearFrBufH[i]); |
1600 WebRtc_InitBuffer(aec->outFrBufH[i]); | 1581 WebRtc_InitBuffer(aec->outFrBufH[i]); |
1601 } | 1582 } |
1602 | 1583 |
1603 // Initialize far-end buffers. | 1584 // Initialize far-end buffers. |
1604 WebRtc_InitBuffer(aec->far_time_buf); | 1585 WebRtc_InitBuffer(aec->far_time_buf); |
1605 | 1586 |
1606 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
1607 { | |
1608 int process_rate = sampFreq > 16000 ? 16000 : sampFreq; | |
1609 RTC_AEC_DEBUG_WAV_REOPEN("aec_far", aec->instance_index, | |
1610 aec->debug_dump_count, process_rate, | |
1611 &aec->farFile); | |
1612 RTC_AEC_DEBUG_WAV_REOPEN("aec_near", aec->instance_index, | |
1613 aec->debug_dump_count, process_rate, | |
1614 &aec->nearFile); | |
1615 RTC_AEC_DEBUG_WAV_REOPEN("aec_out", aec->instance_index, | |
1616 aec->debug_dump_count, process_rate, | |
1617 &aec->outFile); | |
1618 RTC_AEC_DEBUG_WAV_REOPEN("aec_out_linear", aec->instance_index, | |
1619 aec->debug_dump_count, process_rate, | |
1620 &aec->outLinearFile); | |
1621 } | |
1622 | |
1623 RTC_AEC_DEBUG_RAW_OPEN("aec_e_fft", aec->debug_dump_count, &aec->e_fft_file); | |
1624 | |
1625 ++aec->debug_dump_count; | |
1626 #endif | |
1627 aec->system_delay = 0; | 1587 aec->system_delay = 0; |
1628 | 1588 |
1629 if (WebRtc_InitDelayEstimatorFarend(aec->delay_estimator_farend) != 0) { | 1589 if (WebRtc_InitDelayEstimatorFarend(aec->delay_estimator_farend) != 0) { |
1630 return -1; | 1590 return -1; |
1631 } | 1591 } |
1632 if (WebRtc_InitDelayEstimator(aec->delay_estimator) != 0) { | 1592 if (WebRtc_InitDelayEstimator(aec->delay_estimator) != 0) { |
1633 return -1; | 1593 return -1; |
1634 } | 1594 } |
1635 aec->delay_logging_enabled = 0; | 1595 aec->delay_logging_enabled = 0; |
1636 aec->delay_metrics_delivered = 0; | 1596 aec->delay_metrics_delivered = 0; |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 | 1945 |
1986 int WebRtcAec_system_delay(AecCore* self) { | 1946 int WebRtcAec_system_delay(AecCore* self) { |
1987 return self->system_delay; | 1947 return self->system_delay; |
1988 } | 1948 } |
1989 | 1949 |
1990 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { | 1950 void WebRtcAec_SetSystemDelay(AecCore* self, int delay) { |
1991 assert(delay >= 0); | 1951 assert(delay >= 0); |
1992 self->system_delay = delay; | 1952 self->system_delay = delay; |
1993 } | 1953 } |
1994 } // namespace webrtc | 1954 } // namespace webrtc |
OLD | NEW |