| 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);
|
|
|