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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 return rtc::Optional<size_t>(); | 71 return rtc::Optional<size_t>(); |
72 } | 72 } |
73 | 73 |
74 constexpr int kEchoPathChangeCounterInitial = kNumBlocksPerSecond / 5; | 74 constexpr int kEchoPathChangeCounterInitial = kNumBlocksPerSecond / 5; |
75 constexpr int kEchoPathChangeCounterMax = 2 * kNumBlocksPerSecond; | 75 constexpr int kEchoPathChangeCounterMax = 2 * kNumBlocksPerSecond; |
76 | 76 |
77 } // namespace | 77 } // namespace |
78 | 78 |
79 int AecState::instance_count_ = 0; | 79 int AecState::instance_count_ = 0; |
80 | 80 |
81 AecState::AecState() | 81 AecState::AecState(float echo_decay) |
82 : data_dumper_( | 82 : data_dumper_( |
83 new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))), | 83 new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))), |
84 echo_path_change_counter_(kEchoPathChangeCounterInitial) {} | 84 echo_path_change_counter_(kEchoPathChangeCounterInitial), |
| 85 echo_decay_factor_(echo_decay) {} |
85 | 86 |
86 AecState::~AecState() = default; | 87 AecState::~AecState() = default; |
87 | 88 |
88 void AecState::HandleEchoPathChange( | 89 void AecState::HandleEchoPathChange( |
89 const EchoPathVariability& echo_path_variability) { | 90 const EchoPathVariability& echo_path_variability) { |
90 if (echo_path_variability.AudioPathChanged()) { | 91 if (echo_path_variability.AudioPathChanged()) { |
91 blocks_since_last_saturation_ = 0; | 92 blocks_since_last_saturation_ = 0; |
92 usable_linear_estimate_ = false; | 93 usable_linear_estimate_ = false; |
93 echo_leakage_detected_ = false; | 94 echo_leakage_detected_ = false; |
94 capture_signal_saturation_ = false; | 95 capture_signal_saturation_ = false; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // 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 |
175 // 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 |
176 // headset is used. | 177 // headset is used. |
177 headset_detected_ = | 178 headset_detected_ = |
178 !external_delay_ && !filter_delay_ && | 179 !external_delay_ && !filter_delay_ && |
179 (!render_received_ || | 180 (!render_received_ || |
180 blocks_with_filter_adaptation_ >= kEchoPathChangeConvergenceBlocks); | 181 blocks_with_filter_adaptation_ >= kEchoPathChangeConvergenceBlocks); |
181 } | 182 } |
182 | 183 |
183 } // namespace webrtc | 184 } // namespace webrtc |
OLD | NEW |