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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Returns whether a probable headset setup has been detected. | 73 // Returns whether a probable headset setup has been detected. |
74 bool HeadsetDetected() const { return headset_detected_; } | 74 bool HeadsetDetected() const { return headset_detected_; } |
75 | 75 |
76 // Takes appropriate action at an echo path change. | 76 // Takes appropriate action at an echo path change. |
77 void HandleEchoPathChange(const EchoPathVariability& echo_path_variability); | 77 void HandleEchoPathChange(const EchoPathVariability& echo_path_variability); |
78 | 78 |
79 // Returns the decay factor for the echo reverberation. | 79 // Returns the decay factor for the echo reverberation. |
80 // TODO(peah): Make this adaptive. | 80 // TODO(peah): Make this adaptive. |
81 float ReverbDecayFactor() const { return 0.f; } | 81 float ReverbDecayFactor() const { return 0.f; } |
82 | 82 |
| 83 // Returns whether the echo suppression gain should be forced to zero. |
| 84 bool ForcedZeroGain() const { return force_zero_gain_; } |
| 85 |
83 // Updates the aec state. | 86 // Updates the aec state. |
84 void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>& | 87 void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>& |
85 adaptive_filter_frequency_response, | 88 adaptive_filter_frequency_response, |
86 const rtc::Optional<size_t>& external_delay_samples, | 89 const rtc::Optional<size_t>& external_delay_samples, |
87 const RenderBuffer& render_buffer, | 90 const RenderBuffer& render_buffer, |
88 const std::array<float, kFftLengthBy2Plus1>& E2_main, | 91 const std::array<float, kFftLengthBy2Plus1>& E2_main, |
89 const std::array<float, kFftLengthBy2Plus1>& Y2, | 92 const std::array<float, kFftLengthBy2Plus1>& Y2, |
90 rtc::ArrayView<const float> x, | 93 rtc::ArrayView<const float> x, |
91 bool echo_leakage_detected); | 94 bool echo_leakage_detected); |
92 | 95 |
93 private: | 96 private: |
94 static int instance_count_; | 97 static int instance_count_; |
95 std::unique_ptr<ApmDataDumper> data_dumper_; | 98 std::unique_ptr<ApmDataDumper> data_dumper_; |
96 ErlEstimator erl_estimator_; | 99 ErlEstimator erl_estimator_; |
97 ErleEstimator erle_estimator_; | 100 ErleEstimator erle_estimator_; |
98 int echo_path_change_counter_; | 101 int echo_path_change_counter_; |
99 size_t active_render_blocks_ = 0; | 102 size_t active_render_blocks_ = 0; |
100 bool usable_linear_estimate_ = false; | 103 bool usable_linear_estimate_ = false; |
101 bool echo_leakage_detected_ = false; | 104 bool echo_leakage_detected_ = false; |
102 bool capture_signal_saturation_ = false; | 105 bool capture_signal_saturation_ = false; |
103 bool echo_saturation_ = false; | 106 bool echo_saturation_ = false; |
104 bool headset_detected_ = false; | 107 bool headset_detected_ = false; |
105 float previous_max_sample_ = 0.f; | 108 float previous_max_sample_ = 0.f; |
| 109 bool force_zero_gain_ = false; |
| 110 size_t force_zero_gain_counter_ = 0; |
106 rtc::Optional<size_t> filter_delay_; | 111 rtc::Optional<size_t> filter_delay_; |
107 rtc::Optional<size_t> external_delay_; | 112 rtc::Optional<size_t> external_delay_; |
108 size_t blocks_since_last_saturation_ = 1000; | 113 size_t blocks_since_last_saturation_ = 1000; |
109 | 114 |
110 RTC_DISALLOW_COPY_AND_ASSIGN(AecState); | 115 RTC_DISALLOW_COPY_AND_ASSIGN(AecState); |
111 }; | 116 }; |
112 | 117 |
113 } // namespace webrtc | 118 } // namespace webrtc |
114 | 119 |
115 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_ | 120 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_ |
OLD | NEW |