Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: webrtc/modules/audio_processing/aec3/aec_state.h

Issue 2967603002: Added the ability to adjust the AEC3 performance for large rooms (Closed)
Patch Set: Changes in response to reviewer commments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 #include "webrtc/modules/audio_processing/aec3/erle_estimator.h" 24 #include "webrtc/modules/audio_processing/aec3/erle_estimator.h"
25 #include "webrtc/modules/audio_processing/aec3/render_buffer.h" 25 #include "webrtc/modules/audio_processing/aec3/render_buffer.h"
26 26
27 namespace webrtc { 27 namespace webrtc {
28 28
29 class ApmDataDumper; 29 class ApmDataDumper;
30 30
31 // Handles the state and the conditions for the echo removal functionality. 31 // Handles the state and the conditions for the echo removal functionality.
32 class AecState { 32 class AecState {
33 public: 33 public:
34 AecState(); 34 explicit AecState(float echo_decay);
35 ~AecState(); 35 ~AecState();
36 36
37 // Returns whether the linear filter estimate is usable. 37 // Returns whether the linear filter estimate is usable.
38 bool UsableLinearEstimate() const { return usable_linear_estimate_; } 38 bool UsableLinearEstimate() const { return usable_linear_estimate_; }
39 39
40 // Returns whether there has been echo leakage detected. 40 // Returns whether there has been echo leakage detected.
41 bool EchoLeakageDetected() const { return echo_leakage_detected_; } 41 bool EchoLeakageDetected() const { return echo_leakage_detected_; }
42 42
43 // Returns whether the render signal is currently active. 43 // Returns whether the render signal is currently active.
44 // TODO(peah): Deprecate this in an upcoming CL. 44 // TODO(peah): Deprecate this in an upcoming CL.
(...skipping 27 matching lines...) Expand all
72 } 72 }
73 73
74 // Returns whether a probable headset setup has been detected. 74 // Returns whether a probable headset setup has been detected.
75 bool HeadsetDetected() const { return headset_detected_; } 75 bool HeadsetDetected() const { return headset_detected_; }
76 76
77 // Takes appropriate action at an echo path change. 77 // Takes appropriate action at an echo path change.
78 void HandleEchoPathChange(const EchoPathVariability& echo_path_variability); 78 void HandleEchoPathChange(const EchoPathVariability& echo_path_variability);
79 79
80 // Returns the decay factor for the echo reverberation. 80 // Returns the decay factor for the echo reverberation.
81 // TODO(peah): Make this adaptive. 81 // TODO(peah): Make this adaptive.
82 float ReverbDecayFactor() const { return 0.f; } 82 float ReverbDecayFactor() const { return echo_decay_factor_; }
83 83
84 // Returns whether the echo suppression gain should be forced to zero. 84 // Returns whether the echo suppression gain should be forced to zero.
85 bool ForcedZeroGain() const { return force_zero_gain_; } 85 bool ForcedZeroGain() const { return force_zero_gain_; }
86 86
87 // Updates the aec state. 87 // Updates the aec state.
88 void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>& 88 void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>&
89 adaptive_filter_frequency_response, 89 adaptive_filter_frequency_response,
90 const rtc::Optional<size_t>& external_delay_samples, 90 const rtc::Optional<size_t>& external_delay_samples,
91 const RenderBuffer& render_buffer, 91 const RenderBuffer& render_buffer,
92 const std::array<float, kFftLengthBy2Plus1>& E2_main, 92 const std::array<float, kFftLengthBy2Plus1>& E2_main,
(...skipping 13 matching lines...) Expand all
106 bool capture_signal_saturation_ = false; 106 bool capture_signal_saturation_ = false;
107 bool echo_saturation_ = false; 107 bool echo_saturation_ = false;
108 bool headset_detected_ = false; 108 bool headset_detected_ = false;
109 float previous_max_sample_ = 0.f; 109 float previous_max_sample_ = 0.f;
110 bool force_zero_gain_ = false; 110 bool force_zero_gain_ = false;
111 bool render_received_ = false; 111 bool render_received_ = false;
112 size_t force_zero_gain_counter_ = 0; 112 size_t force_zero_gain_counter_ = 0;
113 rtc::Optional<size_t> filter_delay_; 113 rtc::Optional<size_t> filter_delay_;
114 rtc::Optional<size_t> external_delay_; 114 rtc::Optional<size_t> external_delay_;
115 size_t blocks_since_last_saturation_ = 1000; 115 size_t blocks_since_last_saturation_ = 1000;
116 116 const float echo_decay_factor_;
117 RTC_DISALLOW_COPY_AND_ASSIGN(AecState); 117 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AecState);
118 }; 118 };
119 119
120 } // namespace webrtc 120 } // namespace webrtc
121 121
122 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_ 122 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698