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

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

Issue 2254973003: Added functionality for specifying the initial signal level to use for the gain estimation in the l… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 years, 4 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/level_controller/level_controller.cc
diff --git a/webrtc/modules/audio_processing/level_controller/level_controller.cc b/webrtc/modules/audio_processing/level_controller/level_controller.cc
index a9fed9bf95ab04a9a0a6843e0616eb40e9034204..07618e3ba73ff1b411ab58bf510652698d993a3f 100644
--- a/webrtc/modules/audio_processing/level_controller/level_controller.cc
+++ b/webrtc/modules/audio_processing/level_controller/level_controller.cc
@@ -155,6 +155,11 @@ LevelController::LevelController()
LevelController::~LevelController() {}
+void LevelController::SetInitialLevel(float level) {
+ peak_level_estimator_.SetInitialPeakLevel(level);
+ gain_jumpstart_ = true;
+}
+
void LevelController::Initialize(int sample_rate_hz) {
RTC_DCHECK(sample_rate_hz == AudioProcessing::kSampleRate8kHz ||
sample_rate_hz == AudioProcessing::kSampleRate16kHz ||
@@ -206,8 +211,11 @@ void LevelController::Process(AudioBuffer* audio) {
float saturating_gain = saturating_gain_estimator_.GetGain();
// Compute the new gain to apply.
- last_gain_ = gain_selector_.GetNewGain(peak_level, noise_energy,
- saturating_gain, signal_type);
+ last_gain_ = gain_selector_.GetNewGain(
+ peak_level, noise_energy, saturating_gain, gain_jumpstart_, signal_type);
+
+ // Unflag the jumpstart of the gain as it should only happen once.
+ gain_jumpstart_ = false;
// Apply the gain to the signal.
int num_saturations = gain_applier_.Process(last_gain_, audio);

Powered by Google App Engine
This is Rietveld 408576698