The current scheme for setting parameters and specifying the
behavior of the audio processing module is quite complex and hard to
implement in a threadsafe and efficient manner. Therefore a new
scheme for setting the parameters in the audio processing module is
introduced in this CL.
The idea is to roll this scheme out gradually and as a first functionality
in the audio processing module where this is applied the level controller
was chosen. This CL includes the replacement of the Config-based
level controller scheme with the new scheme.
TBR=henrik.lundin@webrtc.org, solenberg@webrtc.org,
BUG=webrtc:5298
Review-Url: https://codereview.webrtc.org/2338493002
Cr-Commit-Position: refs/heads/master@{#14190}
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.h b/webrtc/modules/audio_processing/audio_processing_impl.h
index f83f6ad..fa07281 100644
--- a/webrtc/modules/audio_processing/audio_processing_impl.h
+++ b/webrtc/modules/audio_processing/audio_processing_impl.h
@@ -42,9 +42,10 @@
public:
// Methods forcing APM to run in a single-threaded manner.
// Acquires both the render and capture locks.
- explicit AudioProcessingImpl(const Config& config);
+ explicit AudioProcessingImpl(const webrtc::Config& config);
// AudioProcessingImpl takes ownership of beamformer.
- AudioProcessingImpl(const Config& config, NonlinearBeamformer* beamformer);
+ AudioProcessingImpl(const webrtc::Config& config,
+ NonlinearBeamformer* beamformer);
~AudioProcessingImpl() override;
int Initialize() override;
int Initialize(int input_sample_rate_hz,
@@ -54,7 +55,8 @@
ChannelLayout output_layout,
ChannelLayout reverse_layout) override;
int Initialize(const ProcessingConfig& processing_config) override;
- void SetExtraOptions(const Config& config) override;
+ void ApplyConfig(const AudioProcessing::Config& config) override;
+ void SetExtraOptions(const webrtc::Config& config) override;
void UpdateHistogramsOnCallEnd() override;
int StartDebugRecording(const char filename[kMaxFilenameSize],
int64_t max_log_size_bytes) override;
@@ -341,14 +343,12 @@
struct ApmCaptureNonLockedState {
ApmCaptureNonLockedState(bool beamformer_enabled,
- bool intelligibility_enabled,
- bool level_controller_enabled)
+ bool intelligibility_enabled)
: fwd_proc_format(kSampleRate16kHz),
split_rate(kSampleRate16kHz),
stream_delay_ms(0),
beamformer_enabled(beamformer_enabled),
- intelligibility_enabled(intelligibility_enabled),
- level_controller_enabled(level_controller_enabled) {}
+ intelligibility_enabled(intelligibility_enabled) {}
// Only the rate and samples fields of fwd_proc_format_ are used because the
// forward processing number of channels is mutable and is tracked by the
// capture_audio_.
@@ -357,7 +357,7 @@
int stream_delay_ms;
bool beamformer_enabled;
bool intelligibility_enabled;
- bool level_controller_enabled;
+ bool level_controller_enabled = false;
} capture_nonlocked_;
struct ApmRenderState {