summaryrefslogtreecommitdiff
path: root/chromium/third_party/webrtc/modules/audio_processing/aec3/aec_state.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/webrtc/modules/audio_processing/aec3/aec_state.h')
-rw-r--r--chromium/third_party/webrtc/modules/audio_processing/aec3/aec_state.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/chromium/third_party/webrtc/modules/audio_processing/aec3/aec_state.h b/chromium/third_party/webrtc/modules/audio_processing/aec3/aec_state.h
index 53899e55d14..358c74d8e0b 100644
--- a/chromium/third_party/webrtc/modules/audio_processing/aec3/aec_state.h
+++ b/chromium/third_party/webrtc/modules/audio_processing/aec3/aec_state.h
@@ -72,8 +72,8 @@ class AecState {
capture_signal_saturation_ = capture_signal_saturation;
}
- // Returns whether a probable headset setup has been detected.
- bool HeadsetDetected() const { return headset_detected_; }
+ // Returns whether the transparent mode is active
+ bool TransparentMode() const { return transparent_mode_; }
// Takes appropriate action at an echo path change.
void HandleEchoPathChange(const EchoPathVariability& echo_path_variability);
@@ -92,10 +92,20 @@ class AecState {
echo_audibility_.UpdateWithOutput(e);
}
+ // Returns whether the linear filter should have been able to adapt properly.
+ bool SufficientFilterUpdates() const {
+ return blocks_with_filter_adaptation_ >= kEchoPathChangeConvergenceBlocks;
+ }
+
// Returns whether the echo subtractor can be used to determine the residual
// echo.
bool LinearEchoEstimate() const {
- return UsableLinearEstimate() && !HeadsetDetected();
+ return UsableLinearEstimate() && !TransparentMode();
+ }
+
+ // Returns whether the AEC is in an initial state.
+ bool InitialState() const {
+ return capture_block_counter_ < 3 * kNumBlocksPerSecond;
}
// Updates the aec state.
@@ -103,6 +113,7 @@ class AecState {
adaptive_filter_frequency_response,
const std::array<float, kAdaptiveFilterTimeDomainLength>&
adaptive_filter_impulse_response,
+ bool converged_filter,
const rtc::Optional<size_t>& external_delay_samples,
const RenderBuffer& render_buffer,
const std::array<float, kFftLengthBy2Plus1>& E2_main,
@@ -115,7 +126,8 @@ class AecState {
class EchoAudibility {
public:
void Update(rtc::ArrayView<const float> x,
- const std::array<float, kBlockSize>& s);
+ const std::array<float, kBlockSize>& s,
+ bool converged_filter);
void UpdateWithOutput(rtc::ArrayView<const float> e);
bool InaudibleEcho() const { return inaudible_echo_; }
@@ -133,13 +145,13 @@ class AecState {
std::unique_ptr<ApmDataDumper> data_dumper_;
ErlEstimator erl_estimator_;
ErleEstimator erle_estimator_;
- int echo_path_change_counter_;
+ size_t capture_block_counter_ = 0;
size_t blocks_with_filter_adaptation_ = 0;
bool usable_linear_estimate_ = false;
bool echo_leakage_detected_ = false;
bool capture_signal_saturation_ = false;
bool echo_saturation_ = false;
- bool headset_detected_ = false;
+ bool transparent_mode_ = false;
float previous_max_sample_ = 0.f;
bool force_zero_gain_ = false;
bool render_received_ = false;