| 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 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_ |
| 13 | 13 |
| 14 #include <algorithm> | 14 #include <algorithm> |
| 15 #include <memory> | 15 #include <memory> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" | 18 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" |
| 19 #include "webrtc/modules/audio_processing/aec3/echo_path_variability.h" | 19 #include "webrtc/modules/audio_processing/aec3/echo_path_variability.h" |
| 20 #include "webrtc/modules/audio_processing/aec3/erl_estimator.h" | 20 #include "webrtc/modules/audio_processing/aec3/erl_estimator.h" |
| 21 #include "webrtc/modules/audio_processing/aec3/erle_estimator.h" | 21 #include "webrtc/modules/audio_processing/aec3/erle_estimator.h" |
| 22 #include "webrtc/modules/audio_processing/aec3/render_buffer.h" | 22 #include "webrtc/modules/audio_processing/aec3/render_buffer.h" |
| 23 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 23 #include "webrtc/rtc_base/array_view.h" | 24 #include "webrtc/rtc_base/array_view.h" |
| 24 #include "webrtc/rtc_base/constructormagic.h" | 25 #include "webrtc/rtc_base/constructormagic.h" |
| 25 #include "webrtc/rtc_base/optional.h" | 26 #include "webrtc/rtc_base/optional.h" |
| 26 | 27 |
| 27 namespace webrtc { | 28 namespace webrtc { |
| 28 | 29 |
| 29 class ApmDataDumper; | 30 class ApmDataDumper; |
| 30 | 31 |
| 31 // Handles the state and the conditions for the echo removal functionality. | 32 // Handles the state and the conditions for the echo removal functionality. |
| 32 class AecState { | 33 class AecState { |
| 33 public: | 34 public: |
| 34 explicit AecState(float reverb_decay); | 35 explicit AecState(const AudioProcessing::Config::EchoCanceller3& config); |
| 35 ~AecState(); | 36 ~AecState(); |
| 36 | 37 |
| 37 // Returns whether the linear filter estimate is usable. | 38 // Returns whether the linear filter estimate is usable. |
| 38 bool UsableLinearEstimate() const { return usable_linear_estimate_; } | 39 bool UsableLinearEstimate() const { return usable_linear_estimate_; } |
| 39 | 40 |
| 40 // Returns whether there has been echo leakage detected. | 41 // Returns whether there has been echo leakage detected. |
| 41 bool EchoLeakageDetected() const { return echo_leakage_detected_; } | 42 bool EchoLeakageDetected() const { return echo_leakage_detected_; } |
| 42 | 43 |
| 43 // Returns whether the render signal is currently active. | 44 // Returns whether the render signal is currently active. |
| 44 // TODO(peah): Deprecate this in an upcoming CL. | 45 // TODO(peah): Deprecate this in an upcoming CL. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 bool capture_signal_saturation_ = false; | 134 bool capture_signal_saturation_ = false; |
| 134 bool echo_saturation_ = false; | 135 bool echo_saturation_ = false; |
| 135 bool headset_detected_ = false; | 136 bool headset_detected_ = false; |
| 136 float previous_max_sample_ = 0.f; | 137 float previous_max_sample_ = 0.f; |
| 137 bool force_zero_gain_ = false; | 138 bool force_zero_gain_ = false; |
| 138 bool render_received_ = false; | 139 bool render_received_ = false; |
| 139 size_t force_zero_gain_counter_ = 0; | 140 size_t force_zero_gain_counter_ = 0; |
| 140 rtc::Optional<size_t> filter_delay_; | 141 rtc::Optional<size_t> filter_delay_; |
| 141 rtc::Optional<size_t> external_delay_; | 142 rtc::Optional<size_t> external_delay_; |
| 142 size_t blocks_since_last_saturation_ = 1000; | 143 size_t blocks_since_last_saturation_ = 1000; |
| 143 float reverb_decay_; | |
| 144 float reverb_decay_to_test_ = 0.9f; | 144 float reverb_decay_to_test_ = 0.9f; |
| 145 float reverb_decay_candidate_ = 0.f; | 145 float reverb_decay_candidate_ = 0.f; |
| 146 float reverb_decay_candidate_residual_ = -1.f; | 146 float reverb_decay_candidate_residual_ = -1.f; |
| 147 EchoAudibility echo_audibility_; | 147 EchoAudibility echo_audibility_; |
| 148 const AudioProcessing::Config::EchoCanceller3 config_; |
| 149 float reverb_decay_; |
| 148 | 150 |
| 149 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AecState); | 151 RTC_DISALLOW_COPY_AND_ASSIGN(AecState); |
| 150 }; | 152 }; |
| 151 | 153 |
| 152 } // namespace webrtc | 154 } // namespace webrtc |
| 153 | 155 |
| 154 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_ | 156 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_ |
| OLD | NEW |