Separate AEC3 config from AudioProcessing::Config.
The struct containing the config for AEC3 is removed from
AudioProcessing::Config and is put in a new struct called
EchoCanceller3Config.
AEC3 should no longer be activated through
AudioProcessing::ApplyConfig. Instead an EchoCanceller3Factory
can be injected at AudioProcessing creation.
Bug: webrtc:8346
Change-Id: I27e3592e675eec3632a60c45d9e0d12514c2c567
Reviewed-on: https://webrtc-review.googlesource.com/11420
Reviewed-by: Per Ã…hgren <peah@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20342}
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index 7276712..28bd7ad 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -267,71 +267,9 @@
bool enabled = false;
} high_pass_filter;
- // Enables the next generation AEC functionality. This feature replaces the
- // standard methods for echo removal in the AEC.
- // The functionality is not yet activated in the code and turning this on
- // does not yet have the desired behavior.
+ // Deprecated way of activating AEC3.
+ // TODO(gustaf): Remove when possible.
struct EchoCanceller3 {
- struct Param {
- struct Delay {
- size_t default_delay = 5;
- } delay;
-
- struct Erle {
- float min = 1.f;
- float max_l = 8.f;
- float max_h = 1.5f;
- } erle;
-
- struct EpStrength {
- float lf = 10.f;
- float mf = 10.f;
- float hf = 10.f;
- float default_len = 0.f;
- bool echo_can_saturate = true;
- bool bounded_erl = false;
- } ep_strength;
-
- struct Mask {
- float m1 = 0.01f;
- float m2 = 0.0001f;
- float m3 = 0.01f;
- float m4 = 0.1f;
- float m5 = 0.3f;
- float m6 = 0.0001f;
- float m7 = 0.01f;
- float m8 = 0.0001f;
- float m9 = 0.1f;
- } gain_mask;
-
- struct EchoAudibility {
- float low_render_limit = 4 * 64.f;
- float normal_render_limit = 64.f;
- } echo_audibility;
-
- struct RenderLevels {
- float active_render_limit = 100.f;
- float poor_excitation_render_limit = 150.f;
- } render_levels;
-
- struct GainUpdates {
- struct GainChanges {
- float max_inc;
- float max_dec;
- float rate_inc;
- float rate_dec;
- float min_inc;
- float min_dec;
- };
-
- GainChanges low_noise = {3.f, 3.f, 1.5f, 1.5f, 1.5f, 1.5f};
- GainChanges normal = {2.f, 2.f, 1.5f, 1.5f, 1.2f, 1.2f};
- GainChanges saturation = {1.2f, 1.2f, 1.5f, 1.5f, 1.f, 1.f};
- GainChanges nonlinear = {1.5f, 1.5f, 1.2f, 1.2f, 1.1f, 1.1f};
-
- float floor_first_increase = 0.0001f;
- } gain_updates;
- } param;
bool enabled = false;
} echo_canceller3;
@@ -1194,6 +1132,78 @@
protected:
virtual ~VoiceDetection() {}
};
+
+// Configuration struct for EchoCanceller3
+struct EchoCanceller3Config {
+ struct Delay {
+ size_t default_delay = 5;
+ } delay;
+
+ struct Erle {
+ float min = 1.f;
+ float max_l = 8.f;
+ float max_h = 1.5f;
+ } erle;
+
+ struct EpStrength {
+ float lf = 10.f;
+ float mf = 10.f;
+ float hf = 10.f;
+ float default_len = 0.f;
+ bool echo_can_saturate = true;
+ bool bounded_erl = false;
+ } ep_strength;
+
+ struct Mask {
+ float m1 = 0.01f;
+ float m2 = 0.0001f;
+ float m3 = 0.01f;
+ float m4 = 0.1f;
+ float m5 = 0.3f;
+ float m6 = 0.0001f;
+ float m7 = 0.01f;
+ float m8 = 0.0001f;
+ float m9 = 0.1f;
+ } gain_mask;
+
+ struct EchoAudibility {
+ float low_render_limit = 4 * 64.f;
+ float normal_render_limit = 64.f;
+ } echo_audibility;
+
+ struct RenderLevels {
+ float active_render_limit = 100.f;
+ float poor_excitation_render_limit = 150.f;
+ } render_levels;
+
+ struct GainUpdates {
+ struct GainChanges {
+ float max_inc;
+ float max_dec;
+ float rate_inc;
+ float rate_dec;
+ float min_inc;
+ float min_dec;
+ };
+
+ GainChanges low_noise = {3.f, 3.f, 1.5f, 1.5f, 1.5f, 1.5f};
+ GainChanges normal = {2.f, 2.f, 1.5f, 1.5f, 1.2f, 1.2f};
+ GainChanges saturation = {1.2f, 1.2f, 1.5f, 1.5f, 1.f, 1.f};
+ GainChanges nonlinear = {1.5f, 1.5f, 1.2f, 1.2f, 1.1f, 1.1f};
+
+ float floor_first_increase = 0.0001f;
+ } gain_updates;
+};
+
+class EchoCanceller3Factory : public EchoControlFactory {
+ public:
+ EchoCanceller3Factory();
+ EchoCanceller3Factory(const EchoCanceller3Config& config);
+ std::unique_ptr<EchoControl> Create(int sample_rate_hz) override;
+
+ private:
+ EchoCanceller3Config config_;
+};
} // namespace webrtc
#endif // MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_