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

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: Changed parameter name from initial_level to the more correct initial_peak_level Created 4 years, 3 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 9b7b95334542f70241458488324d614a4ec19554..92d7fc0cf0d7cf4ab9058298ea127083c85f9944 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,29 +526,35 @@ 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();
+ AudioProcessing::Config::LevelController default_config;
+ config_.level_controller = default_config;
the sun 2016/09/16 12:40:24 nit: Do this in one line. No need to name temporar
peah-webrtc 2016/09/19 16:37:10 Done.
}
// 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 !=
+ // TODO(peah): Replace the use of capture_nonlocked_.level_controller_enabled
+ // with the value in config_ everywhere in the code.
+ if (config_.level_controller.enabled !=
capture_nonlocked_.level_controller_enabled) {
+ capture_nonlocked_.level_controller_enabled =
+ config.level_controller.enabled;
the sun 2016/09/16 12:40:24 config_ where is the test case? nit: it is nice i
peah-webrtc 2016/09/19 16:37:10 The test case is in audio_processing_unittests.cc.
the sun 2016/09/19 18:53:56 Ah, the problem with the test is it checks the fla
peah-webrtc 2016/09/22 06:00:06 I fully agree. We should definitely have that. For
+ // 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;
}
the sun 2016/09/16 12:40:24 Did you forget lc->ApplyConfig()?
peah-webrtc 2016/09/19 16:37:10 Oh no! Great find! I for sure did miss that. I'm
the sun 2016/09/19 18:53:56 Let's discuss offline.
peah-webrtc 2016/09/22 06:00:06 Acknowledged.
}

Powered by Google App Engine
This is Rietveld 408576698