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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 constexpr size_t kSaturationLeakageBlocks = 10; | 22 constexpr size_t kSaturationLeakageBlocks = 10; |
23 constexpr size_t kEchoPathChangeConvergenceBlocks = 3 * 250; | 23 constexpr size_t kEchoPathChangeConvergenceBlocks = 3 * 250; |
24 | 24 |
25 // Estimates the residual echo power when there is no detection correlation | 25 // Estimates the residual echo power when there is no detection correlation |
26 // between the render and capture signals. | 26 // between the render and capture signals. |
27 void InfiniteErlPowerEstimate( | 27 void InfiniteErlPowerEstimate( |
28 size_t active_render_blocks, | 28 size_t active_render_blocks, |
29 size_t blocks_since_last_saturation, | 29 size_t blocks_since_last_saturation, |
30 const std::array<float, kFftLengthBy2Plus1>& S2_fallback, | 30 const std::array<float, kFftLengthBy2Plus1>& S2_fallback, |
31 std::array<float, kFftLengthBy2Plus1>* R2) { | 31 std::array<float, kFftLengthBy2Plus1>* R2) { |
32 if (active_render_blocks > 5 * 250) { | 32 if (active_render_blocks > 20 * 250) { |
33 // After an amount of active render samples for which an echo should have | 33 // After an amount of active render samples for which an echo should have |
34 // been detected in the capture signal if the ERL was not infinite, set the | 34 // been detected in the capture signal if the ERL was not infinite, set the |
35 // residual echo to 0. | 35 // residual echo to 0. |
36 R2->fill(0.f); | 36 R2->fill(0.f); |
37 } else { | 37 } else { |
38 // Before certainty has been reached about the presence of echo, use the | 38 // Before certainty has been reached about the presence of echo, use the |
39 // fallback echo power estimate as the residual echo estimate. Add a leakage | 39 // fallback echo power estimate as the residual echo estimate. Add a leakage |
40 // factor when there is saturation. | 40 // factor when there is saturation. |
41 std::copy(S2_fallback.begin(), S2_fallback.end(), R2->begin()); | 41 std::copy(S2_fallback.begin(), S2_fallback.end(), R2->begin()); |
42 if (blocks_since_last_saturation < kSaturationLeakageBlocks) { | 42 if (blocks_since_last_saturation < kSaturationLeakageBlocks) { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 void ResidualEchoEstimator::HandleEchoPathChange( | 224 void ResidualEchoEstimator::HandleEchoPathChange( |
225 const EchoPathVariability& echo_path_variability) { | 225 const EchoPathVariability& echo_path_variability) { |
226 if (echo_path_variability.AudioPathChanged()) { | 226 if (echo_path_variability.AudioPathChanged()) { |
227 blocks_since_last_saturation_ = 0; | 227 blocks_since_last_saturation_ = 0; |
228 echo_path_gain_.fill(100.f); | 228 echo_path_gain_.fill(100.f); |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
232 } // namespace webrtc | 232 } // namespace webrtc |
OLD | NEW |