Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: webrtc/modules/audio_processing/audio_processing_impl.cc

Issue 2337083002: Reland of added functionality for specifying the initial signal level to use for the gain estimation (Closed)
Patch Set: Fixed type conversion error Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 5e08b85fbf83ebe1ac5be1d75b8b5ec036d37df9..85f159716cf9d49753fad1fdd18108971b922a9b 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());
}
@@ -543,30 +545,36 @@ 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)
<< 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) {
- InitializeLevelController();
- LOG(LS_INFO) << "Level controller activated: "
- << 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;
+ 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();
}
+ LOG(LS_INFO) << "Level controller activated: "
+ << capture_nonlocked_.level_controller_enabled;
+
+ private_submodules_->level_controller->ApplyConfig(config_.level_controller);
}
void AudioProcessingImpl::SetExtraOptions(const webrtc::Config& config) {
« no previous file with comments | « webrtc/modules/audio_processing/audio_processing_impl.h ('k') | webrtc/modules/audio_processing/audio_processing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698