OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 #include "webrtc/modules/audio_processing/aec3/echo_path_delay_estimator.h" | 10 #include "webrtc/modules/audio_processing/aec3/echo_path_delay_estimator.h" |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <array> | 13 #include <array> |
14 | 14 |
15 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" | 15 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" |
16 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 16 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
17 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" | 17 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" |
18 #include "webrtc/rtc_base/checks.h" | 18 #include "webrtc/rtc_base/checks.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 constexpr int kDownSamplingFactor = 4; | 24 constexpr int kDownSamplingFactor = 4; |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 EchoPathDelayEstimator::EchoPathDelayEstimator(ApmDataDumper* data_dumper) | 27 EchoPathDelayEstimator::EchoPathDelayEstimator( |
| 28 ApmDataDumper* data_dumper, |
| 29 const AudioProcessing::Config::EchoCanceller3& config) |
28 : data_dumper_(data_dumper), | 30 : data_dumper_(data_dumper), |
29 matched_filter_(data_dumper_, | 31 matched_filter_(data_dumper_, |
30 DetectOptimization(), | 32 DetectOptimization(), |
31 kMatchedFilterWindowSizeSubBlocks, | 33 kMatchedFilterWindowSizeSubBlocks, |
32 kNumMatchedFilters, | 34 kNumMatchedFilters, |
33 kMatchedFilterAlignmentShiftSizeSubBlocks), | 35 kMatchedFilterAlignmentShiftSizeSubBlocks, |
| 36 config.param.render_levels.poor_excitation_render_limit), |
34 matched_filter_lag_aggregator_(data_dumper_, | 37 matched_filter_lag_aggregator_(data_dumper_, |
35 matched_filter_.NumLagEstimates()) { | 38 matched_filter_.NumLagEstimates()) { |
36 RTC_DCHECK(data_dumper); | 39 RTC_DCHECK(data_dumper); |
37 } | 40 } |
38 | 41 |
39 EchoPathDelayEstimator::~EchoPathDelayEstimator() = default; | 42 EchoPathDelayEstimator::~EchoPathDelayEstimator() = default; |
40 | 43 |
41 void EchoPathDelayEstimator::Reset() { | 44 void EchoPathDelayEstimator::Reset() { |
42 matched_filter_lag_aggregator_.Reset(); | 45 matched_filter_lag_aggregator_.Reset(); |
43 matched_filter_.Reset(); | 46 matched_filter_.Reset(); |
(...skipping 22 matching lines...) Expand all Loading... |
66 | 69 |
67 // Return the detected delay in samples as the aggregated matched filter lag | 70 // Return the detected delay in samples as the aggregated matched filter lag |
68 // compensated by the down sampling factor for the signal being correlated. | 71 // compensated by the down sampling factor for the signal being correlated. |
69 return aggregated_matched_filter_lag | 72 return aggregated_matched_filter_lag |
70 ? rtc::Optional<size_t>(*aggregated_matched_filter_lag * | 73 ? rtc::Optional<size_t>(*aggregated_matched_filter_lag * |
71 kDownSamplingFactor) | 74 kDownSamplingFactor) |
72 : rtc::Optional<size_t>(); | 75 : rtc::Optional<size_t>(); |
73 } | 76 } |
74 | 77 |
75 } // namespace webrtc | 78 } // namespace webrtc |
OLD | NEW |