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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 *filter_delay = | 75 *filter_delay = |
76 num_reliable_delays > 20 | 76 num_reliable_delays > 20 |
77 ? rtc::Optional<size_t>(reliable_delays_sum / num_reliable_delays) | 77 ? rtc::Optional<size_t>(reliable_delays_sum / num_reliable_delays) |
78 : rtc::Optional<size_t>(); | 78 : rtc::Optional<size_t>(); |
79 } | 79 } |
80 | 80 |
81 constexpr int kActiveRenderCounterInitial = 50; | 81 constexpr int kActiveRenderCounterInitial = 50; |
82 constexpr int kActiveRenderCounterMax = 200; | 82 constexpr int kActiveRenderCounterMax = 200; |
83 constexpr int kEchoPathChangeCounterInitial = 50; | 83 constexpr int kEchoPathChangeCounterInitial = 50; |
84 constexpr int kEchoPathChangeCounterMax = 200; | 84 constexpr int kEchoPathChangeCounterMax = 3 * 250; |
85 | 85 |
86 } // namespace | 86 } // namespace |
87 | 87 |
88 int AecState::instance_count_ = 0; | 88 int AecState::instance_count_ = 0; |
89 | 89 |
90 AecState::AecState() | 90 AecState::AecState() |
91 : data_dumper_( | 91 : data_dumper_( |
92 new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))), | 92 new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))), |
93 echo_path_change_counter_(kEchoPathChangeCounterInitial), | 93 echo_path_change_counter_(kEchoPathChangeCounterInitial), |
94 active_render_counter_(kActiveRenderCounterInitial) { | 94 active_render_counter_(kActiveRenderCounterInitial) { |
(...skipping 18 matching lines...) Expand all Loading... |
113 &filter_estimate_strength_, &filter_delay_); | 113 &filter_estimate_strength_, &filter_delay_); |
114 // Compute the externally provided delay in partitions. The truncation is | 114 // Compute the externally provided delay in partitions. The truncation is |
115 // intended here. | 115 // intended here. |
116 external_delay_ = | 116 external_delay_ = |
117 external_delay_samples | 117 external_delay_samples |
118 ? rtc::Optional<size_t>(*external_delay_samples / kBlockSize) | 118 ? rtc::Optional<size_t>(*external_delay_samples / kBlockSize) |
119 : rtc::Optional<size_t>(); | 119 : rtc::Optional<size_t>(); |
120 | 120 |
121 const float x_energy = std::inner_product(x.begin(), x.end(), x.begin(), 0.f); | 121 const float x_energy = std::inner_product(x.begin(), x.end(), x.begin(), 0.f); |
122 | 122 |
| 123 active_render_blocks_ = |
| 124 echo_path_variability.AudioPathChanged() ? 0 : active_render_blocks_ + 1; |
| 125 |
123 echo_path_change_counter_ = echo_path_variability.AudioPathChanged() | 126 echo_path_change_counter_ = echo_path_variability.AudioPathChanged() |
124 ? kEchoPathChangeCounterMax | 127 ? kEchoPathChangeCounterMax |
125 : echo_path_change_counter_ - 1; | 128 : echo_path_change_counter_ - 1; |
126 active_render_counter_ = x_energy > 10000.f * kFftLengthBy2 | 129 active_render_counter_ = x_energy > 10000.f * kFftLengthBy2 |
127 ? kActiveRenderCounterMax | 130 ? kActiveRenderCounterMax |
128 : active_render_counter_ - 1; | 131 : active_render_counter_ - 1; |
129 | 132 |
130 usable_linear_estimate_ = filter_delay_ && echo_path_change_counter_ <= 0; | 133 usable_linear_estimate_ = filter_delay_ && echo_path_change_counter_ <= 0; |
131 | 134 |
132 echo_leakage_detected_ = echo_leakage_detected; | 135 echo_leakage_detected_ = echo_leakage_detected; |
(...skipping 20 matching lines...) Expand all Loading... |
153 [](float a) { return a <= 10.f; }); | 156 [](float a) { return a <= 10.f; }); |
154 headset_detected_ = low_erl_band_count > 20 && noisy_band_count > 20; | 157 headset_detected_ = low_erl_band_count > 20 && noisy_band_count > 20; |
155 #endif | 158 #endif |
156 headset_detected_ = false; | 159 headset_detected_ = false; |
157 } else { | 160 } else { |
158 headset_detected_ = false; | 161 headset_detected_ = false; |
159 } | 162 } |
160 } | 163 } |
161 | 164 |
162 } // namespace webrtc | 165 } // namespace webrtc |
OLD | NEW |