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 | 10 |
11 #include "webrtc/modules/audio_processing/aec3/aec_state.h" | 11 #include "webrtc/modules/audio_processing/aec3/aec_state.h" |
12 | 12 |
13 #include <math.h> | 13 #include <math.h> |
14 #include <numeric> | 14 #include <numeric> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
| 17 #include "webrtc/base/array_view.h" |
| 18 #include "webrtc/base/atomicops.h" |
| 19 #include "webrtc/base/checks.h" |
17 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" | 20 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" |
18 #include "webrtc/rtc_base/array_view.h" | |
19 #include "webrtc/rtc_base/atomicops.h" | |
20 #include "webrtc/rtc_base/checks.h" | |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 namespace { | 23 namespace { |
24 | 24 |
25 constexpr size_t kEchoPathChangeConvergenceBlocks = 2 * kNumBlocksPerSecond; | 25 constexpr size_t kEchoPathChangeConvergenceBlocks = 2 * kNumBlocksPerSecond; |
26 constexpr size_t kSaturationLeakageBlocks = 20; | 26 constexpr size_t kSaturationLeakageBlocks = 20; |
27 | 27 |
28 // Computes delay of the adaptive filter. | 28 // Computes delay of the adaptive filter. |
29 rtc::Optional<size_t> EstimateFilterDelay( | 29 rtc::Optional<size_t> EstimateFilterDelay( |
30 const std::vector<std::array<float, kFftLengthBy2Plus1>>& | 30 const std::vector<std::array<float, kFftLengthBy2Plus1>>& |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // After an amount of active render samples for which an echo should have been | 175 // After an amount of active render samples for which an echo should have been |
176 // detected in the capture signal if the ERL was not infinite, flag that a | 176 // detected in the capture signal if the ERL was not infinite, flag that a |
177 // headset is used. | 177 // headset is used. |
178 headset_detected_ = | 178 headset_detected_ = |
179 !external_delay_ && !filter_delay_ && | 179 !external_delay_ && !filter_delay_ && |
180 (!render_received_ || | 180 (!render_received_ || |
181 blocks_with_filter_adaptation_ >= kEchoPathChangeConvergenceBlocks); | 181 blocks_with_filter_adaptation_ >= kEchoPathChangeConvergenceBlocks); |
182 } | 182 } |
183 | 183 |
184 } // namespace webrtc | 184 } // namespace webrtc |
OLD | NEW |