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.

BUG=webrtc:5298

Review-Url: https://codereview.webrtc.org/2292863002
Cr-Commit-Position: refs/heads/master@{#14171}
This commit is contained in:
peah
2016-09-09 14:15:57 -07:00
committed by Commit bot
parent e753641ef1
commit c8bbe3fe9a
17 changed files with 167 additions and 76 deletions

View File

@ -42,9 +42,10 @@ class AudioProcessingImpl : public AudioProcessing {
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 @@ class AudioProcessingImpl : public AudioProcessing {
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;
@ -312,14 +314,12 @@ class AudioProcessingImpl : public AudioProcessing {
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_.
@ -328,7 +328,7 @@ class AudioProcessingImpl : public AudioProcessing {
int stream_delay_ms;
bool beamformer_enabled;
bool intelligibility_enabled;
bool level_controller_enabled;
bool level_controller_enabled = false;
} capture_nonlocked_;
struct ApmRenderState {