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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 blocks_since_last_saturation_ = | 168 blocks_since_last_saturation_ = |
169 saturated_echo ? 0 : blocks_since_last_saturation_ + 1; | 169 saturated_echo ? 0 : blocks_since_last_saturation_ + 1; |
170 echo_saturation_ = blocks_since_last_saturation_ < kSaturationLeakageBlocks; | 170 echo_saturation_ = blocks_since_last_saturation_ < kSaturationLeakageBlocks; |
171 | 171 |
172 // Flag whether the linear filter estimate is usable. | 172 // Flag whether the linear filter estimate is usable. |
173 constexpr size_t kEchoPathChangeConvergenceBlocks = 2 * kNumBlocksPerSecond; | 173 constexpr size_t kEchoPathChangeConvergenceBlocks = 2 * kNumBlocksPerSecond; |
174 usable_linear_estimate_ = | 174 usable_linear_estimate_ = |
175 (!echo_saturation_) && | 175 (!echo_saturation_) && |
176 (!render_received_ || | 176 (!render_received_ || |
177 blocks_with_filter_adaptation_ > kEchoPathChangeConvergenceBlocks) && | 177 blocks_with_filter_adaptation_ > kEchoPathChangeConvergenceBlocks) && |
178 filter_delay_ && echo_path_change_counter_ <= 0; | 178 filter_delay_ && echo_path_change_counter_ <= 0 && external_delay_; |
179 | 179 |
180 // After an amount of active render samples for which an echo should have been | 180 // After an amount of active render samples for which an echo should have been |
181 // detected in the capture signal if the ERL was not infinite, flag that a | 181 // detected in the capture signal if the ERL was not infinite, flag that a |
182 // headset is used. | 182 // headset is used. |
183 constexpr size_t kHeadSetDetectionBlocks = 5 * kNumBlocksPerSecond; | 183 constexpr size_t kHeadSetDetectionBlocks = 5 * kNumBlocksPerSecond; |
184 headset_detected_ = !external_delay_ && !filter_delay_ && | 184 headset_detected_ = !external_delay_ && !filter_delay_ && |
185 (!render_received_ || blocks_with_filter_adaptation_ >= | 185 (!render_received_ || blocks_with_filter_adaptation_ >= |
186 kHeadSetDetectionBlocks); | 186 kHeadSetDetectionBlocks); |
187 | 187 |
188 // Update the room reverb estimate. | 188 // Update the room reverb estimate. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 max_nearend_ = e_abs; | 300 max_nearend_ = e_abs; |
301 max_nearend_counter_ = 0; | 301 max_nearend_counter_ = 0; |
302 } else { | 302 } else { |
303 if (++max_nearend_counter_ > 5 * kNumBlocksPerSecond) { | 303 if (++max_nearend_counter_ > 5 * kNumBlocksPerSecond) { |
304 max_nearend_ *= 0.995f; | 304 max_nearend_ *= 0.995f; |
305 } | 305 } |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 } // namespace webrtc | 309 } // namespace webrtc |
OLD | NEW |