From 64d6ff77ffa326cb6132706f7ed3879081b0b92f Mon Sep 17 00:00:00 2001 From: peah Date: Mon, 21 Nov 2016 06:28:14 -0800 Subject: [PATCH] In VoiceEngine, the settings for APM are applied in such a way that the previously specified setting is changed if it is specified to be changed, and otherwise the previously specified setting is kept as it is. This CL replicates this functionality for the way that the new APM parameter scheme is used. BUG=webrtc::6220, webrtc::6296, webrtc::6297, webrtc::6181, webrtc::5298 Review-Url: https://codereview.webrtc.org/2489343002 Cr-Commit-Position: refs/heads/master@{#15167} --- webrtc/media/engine/webrtcvoiceengine.cc | 7 +++---- webrtc/media/engine/webrtcvoiceengine.h | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/webrtc/media/engine/webrtcvoiceengine.cc b/webrtc/media/engine/webrtcvoiceengine.cc index 57921acb70..1f88cb7245 100644 --- a/webrtc/media/engine/webrtcvoiceengine.cc +++ b/webrtc/media/engine/webrtcvoiceengine.cc @@ -912,17 +912,16 @@ bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { LOG(LS_INFO) << "Level control: " << (!!level_control_ ? *level_control_ : -1); - webrtc::AudioProcessing::Config apm_config; if (level_control_) { - apm_config.level_controller.enabled = *level_control_; + apm_config_.level_controller.enabled = *level_control_; if (options.level_control_initial_peak_level_dbfs) { - apm_config.level_controller.initial_peak_level_dbfs = + apm_config_.level_controller.initial_peak_level_dbfs = *options.level_control_initial_peak_level_dbfs; } } apm()->SetExtraOptions(config); - apm()->ApplyConfig(apm_config); + apm()->ApplyConfig(apm_config_); if (options.recording_sample_rate) { LOG(LS_INFO) << "Recording sample rate is " diff --git a/webrtc/media/engine/webrtcvoiceengine.h b/webrtc/media/engine/webrtcvoiceengine.h index c80c06a894..efb7120201 100644 --- a/webrtc/media/engine/webrtcvoiceengine.h +++ b/webrtc/media/engine/webrtcvoiceengine.h @@ -28,6 +28,7 @@ #include "webrtc/media/base/rtputils.h" #include "webrtc/media/engine/webrtccommon.h" #include "webrtc/media/engine/webrtcvoe.h" +#include "webrtc/modules/audio_processing/include/audio_processing.h" #include "webrtc/pc/channel.h" namespace cricket { @@ -134,6 +135,8 @@ class WebRtcVoiceEngine final : public webrtc::TraceCallback { rtc::Optional intelligibility_enhancer_; rtc::Optional level_control_; + webrtc::AudioProcessing::Config apm_config_; + RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcVoiceEngine); };