Index: webrtc/modules/audio_processing/audio_processing_impl.cc |
diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc |
index 9b7b95334542f70241458488324d614a4ec19554..2de199446cf5c2d207b0eb2adcacbe5f1fad810d 100644 |
--- a/webrtc/modules/audio_processing/audio_processing_impl.cc |
+++ b/webrtc/modules/audio_processing/audio_processing_impl.cc |
@@ -298,6 +298,8 @@ AudioProcessingImpl::AudioProcessingImpl(const webrtc::Config& config, |
new GainControlForExperimentalAgc( |
public_submodules_->gain_control.get(), &crit_capture_)); |
+ // TODO(peah): Move this creation to happen only when the level controller |
+ // is enabled. |
private_submodules_->level_controller.reset(new LevelController()); |
} |
@@ -524,30 +526,37 @@ int AudioProcessingImpl::InitializeLocked(const ProcessingConfig& config) { |
} |
void AudioProcessingImpl::ApplyConfig(const AudioProcessing::Config& config) { |
- AudioProcessing::Config config_to_use = config; |
+ config_ = config; |
- bool config_ok = LevelController::Validate(config_to_use.level_controller); |
+ bool config_ok = LevelController::Validate(config_.level_controller); |
if (!config_ok) { |
LOG(LS_ERROR) << "AudioProcessing module config error" << std::endl |
<< "level_controller: " |
- << LevelController::ToString(config_to_use.level_controller) |
+ << LevelController::ToString(config.level_controller) |
the sun
2016/09/30 08:51:16
use config_
peah-webrtc
2016/10/03 09:52:13
Done.
hlundin-webrtc
2016/10/05 12:29:18
To be precise, you are now using config, not confi
peah-webrtc
2016/10/06 06:27:27
In the latest patchset, this is now changed to con
|
<< std::endl |
<< "Reverting to default parameter set"; |
- config_to_use.level_controller = AudioProcessing::Config::LevelController(); |
+ config_.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) { |
+ // TODO(peah): Replace the use of capture_nonlocked_.level_controller_enabled |
+ // with the value in config_ everywhere in the code. |
+ if (capture_nonlocked_.level_controller_enabled != |
+ config_.level_controller.enabled) { |
+ capture_nonlocked_.level_controller_enabled = |
+ config_.level_controller.enabled; |
+ // TODO(peah): Remove the conditional initialization to always initialize |
+ // the level controller regardless of whether it is enabled or not. |
InitializeLevelController(); |
+ // TODO(peah): Add logline regardless of whether this is enabled or not. |
LOG(LS_INFO) << "Level controller activated: " |
<< capture_nonlocked_.level_controller_enabled; |
- capture_nonlocked_.level_controller_enabled = |
- config.level_controller.enabled; |
} |
+ |
+ private_submodules_->level_controller->ApplyConfig(config_.level_controller); |
} |
void AudioProcessingImpl::SetExtraOptions(const webrtc::Config& config) { |