APM: fix level estimator null pointer bug

When APM is used without calling `ApplyConfig()` and the level
estimator sub-module, which is disabled by default (see [1]), is used,
APM crashes because the enabled config flag is true, but the unique
pointer object is unset.

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/modules/audio_processing/include/audio_processing.h;l=391?q=include%2Faudio_processing.h

Bug: webrtc:7494
Change-Id: I482a9aa4f6a0a56793769674aba7b2661330bb14
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235375
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35230}
This commit is contained in:
Alessio Bazzica
2021-10-18 11:32:05 +02:00
committed by WebRTC LUCI CQ
parent 50c25ac078
commit bf2a70a14d
2 changed files with 15 additions and 5 deletions

View File

@ -284,6 +284,7 @@ class AudioProcessingImpl : public AudioProcessing {
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_capture_);
void InitializePostProcessor() RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_capture_);
void InitializeAnalyzer() RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_capture_);
void InitializeLevelEstimator() RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_capture_);
// Initializations of render-only submodules, requiring the render lock
// already acquired.