Make the extra seturation margin configurable.
The extra saturation margin is a setting for the SaturationProtector
in GainController2. The higher it is, the less gain GC2 will apply. In
this CL we pipe the setting up to audio_processing.h. Now the setting
can be set at a high level.
Also in this CL add a few (missing, they should have been there
already) tests for the GC2 and GC2 with saturation margin.
Bug: webrtc:7494
Change-Id: I1b61f1662e6c6a8817fd5b0e845339694bf8d50d
Reviewed-on: https://webrtc-review.googlesource.com/c/109001
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25470}
diff --git a/modules/audio_processing/agc2/saturation_protector.h b/modules/audio_processing/agc2/saturation_protector.h
index 1705f6ac..e637469 100644
--- a/modules/audio_processing/agc2/saturation_protector.h
+++ b/modules/audio_processing/agc2/saturation_protector.h
@@ -24,6 +24,9 @@
public:
explicit SaturationProtector(ApmDataDumper* apm_data_dumper);
+ SaturationProtector(ApmDataDumper* apm_data_dumper,
+ float extra_saturation_margin_db);
+
// Update and return margin estimate. This method should be called
// whenever a frame is reliably classified as 'speech'.
//
@@ -60,7 +63,7 @@
float last_margin_;
PeakEnveloper peak_enveloper_;
- float extra_saturation_margin_db_;
+ const float extra_saturation_margin_db_;
};
} // namespace webrtc