Revert of Introduced new scheme for controlling the functionality inside the audio processing module (patchset #12 id:260001 of https://codereview.webrtc.org/2292863002/ )
Reason for revert:
Interface change in the mock breaks downstream code.
Original issue's description:
> 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
>
> Committed: https://crrev.com/c8bbe3fe9aad9e9a1189a42dcaa8f5d6c261ecc8
> Cr-Commit-Position: refs/heads/master@{#14171}
TBR=solenberg@webrtc.org,henrik.lundin@webrtc.org,peah@webrtc.org
BUG=webrtc:5298
NOTRY=True
Review-Url: https://codereview.webrtc.org/2334583002
Cr-Commit-Position: refs/heads/master@{#14177}
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc
index 72f154a..bd311ad 100644
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc
@@ -241,15 +241,15 @@
};
AudioProcessing* AudioProcessing::Create() {
- webrtc::Config config;
+ Config config;
return Create(config, nullptr);
}
-AudioProcessing* AudioProcessing::Create(const webrtc::Config& config) {
+AudioProcessing* AudioProcessing::Create(const Config& config) {
return Create(config, nullptr);
}
-AudioProcessing* AudioProcessing::Create(const webrtc::Config& config,
+AudioProcessing* AudioProcessing::Create(const Config& config,
NonlinearBeamformer* beamformer) {
AudioProcessingImpl* apm = new AudioProcessingImpl(config, beamformer);
if (apm->Initialize() != kNoError) {
@@ -260,10 +260,10 @@
return apm;
}
-AudioProcessingImpl::AudioProcessingImpl(const webrtc::Config& config)
+AudioProcessingImpl::AudioProcessingImpl(const Config& config)
: AudioProcessingImpl(config, nullptr) {}
-AudioProcessingImpl::AudioProcessingImpl(const webrtc::Config& config,
+AudioProcessingImpl::AudioProcessingImpl(const Config& config,
NonlinearBeamformer* beamformer)
: public_submodules_(new ApmPublicSubmodules()),
private_submodules_(new ApmPrivateSubmodules(beamformer)),
@@ -281,7 +281,8 @@
config.Get<Beamforming>().array_geometry,
config.Get<Beamforming>().target_direction),
capture_nonlocked_(config.Get<Beamforming>().enabled,
- config.Get<Intelligibility>().enabled) {
+ config.Get<Intelligibility>().enabled,
+ config.Get<LevelControl>().enabled) {
{
rtc::CritScope cs_render(&crit_render_);
rtc::CritScope cs_capture(&crit_capture_);
@@ -529,34 +530,7 @@
return InitializeLocked();
}
-void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) {
- AudioProcessing::Config config_to_use = config;
-
- bool config_ok = LevelController::Validate(config_to_use.level_controller);
- if (!config_ok) {
- LOG(LS_ERROR) << "AudioProcessing module config error" << std::endl
- << "level_controller: "
- << LevelController::ToString(config_to_use.level_controller)
- << std::endl
- << "Reverting to default parameter set";
- config_to_use.level_controller = AudioProcessing::Config::LevelController();
- }
-
- // Run in a single-threaded manner when applying the settings.
- rtc::CritScope cs_render(&crit_render_);
- rtc::CritScope cs_capture(&crit_capture_);
-
- if (config.level_controller.enabled !=
- capture_nonlocked_.level_controller_enabled) {
- InitializeLevelController();
- LOG(LS_INFO) << "Level controller activated: "
- << capture_nonlocked_.level_controller_enabled;
- capture_nonlocked_.level_controller_enabled =
- config.level_controller.enabled;
- }
-}
-
-void AudioProcessingImpl::SetExtraOptions(const webrtc::Config& config) {
+void AudioProcessingImpl::SetExtraOptions(const Config& config) {
// Run in a single-threaded manner when setting the extra options.
rtc::CritScope cs_render(&crit_render_);
rtc::CritScope cs_capture(&crit_capture_);
@@ -570,6 +544,16 @@
InitializeTransient();
}
+ if (capture_nonlocked_.level_controller_enabled !=
+ config.Get<LevelControl>().enabled) {
+ capture_nonlocked_.level_controller_enabled =
+ config.Get<LevelControl>().enabled;
+ LOG(LS_INFO) << "Level controller activated: "
+ << config.Get<LevelControl>().enabled;
+
+ InitializeLevelController();
+ }
+
#if WEBRTC_INTELLIGIBILITY_ENHANCER
if(capture_nonlocked_.intelligibility_enabled !=
config.Get<Intelligibility>().enabled) {