audio_processing/agc: Adds config to set minimum microphone volume at startup

The AGC is currently bumping up the mic volume to 33% at startup if it is below that level. This is to avoid getting stuck in a poor state from which the AGC can not move, simply a too low input audio level. For some users, 33% is instead too loud.

This CL gives the user the possibility to set that level at create time.
- Extends the Config ExperimentalAgc with a startup_mic_volume for the user to set if desired. Note that the bump up does not apply to the legacy AGC and the "regular" AGC is controlled by ExperimentalAgc.
- Without any actions, the same default value as previously is used.
- In addition I removed a return value from InitializeExperimentalAgc() and InitializeTransient()

This has been tested by building Chromium on Mac and verify through apprtc that
1) startup_mic_volume = 128 bumps up to 50%.
2) startup_mic_volume = 500 (out of range) bumps up to 100%.
3) startup_mic_volume = 0 bumps up to 4%, the AGC min level.

BUG=4529
TESTED=locally
R=andrew@webrtc.org, kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/43109004

Cr-Commit-Position: refs/heads/master@{#9004}
This commit is contained in:
Bjorn Volcker
2015-04-15 11:42:40 +02:00
parent 19a3807b36
commit adc46c4cf7
6 changed files with 53 additions and 33 deletions

View File

@ -177,6 +177,7 @@ AudioProcessingImpl::AudioProcessingImpl(const Config& config,
#else
use_new_agc_(config.Get<ExperimentalAgc>().enabled),
#endif
agc_startup_min_volume_(config.Get<ExperimentalAgc>().startup_min_volume),
transient_suppressor_enabled_(config.Get<ExperimentalNs>().enabled),
beamformer_enabled_(config.Get<Beamforming>().enabled),
beamformer_(beamformer),
@ -285,15 +286,9 @@ int AudioProcessingImpl::InitializeLocked() {
}
}
int err = InitializeExperimentalAgc();
if (err != kNoError) {
return err;
}
InitializeExperimentalAgc();
err = InitializeTransient();
if (err != kNoError) {
return err;
}
InitializeTransient();
InitializeBeamformer();
@ -959,19 +954,19 @@ bool AudioProcessingImpl::analysis_needed(bool is_data_processed) const {
return false;
}
int AudioProcessingImpl::InitializeExperimentalAgc() {
void AudioProcessingImpl::InitializeExperimentalAgc() {
if (use_new_agc_) {
if (!agc_manager_.get()) {
agc_manager_.reset(
new AgcManagerDirect(gain_control_, gain_control_for_new_agc_.get()));
agc_manager_.reset(new AgcManagerDirect(gain_control_,
gain_control_for_new_agc_.get(),
agc_startup_min_volume_));
}
agc_manager_->Initialize();
agc_manager_->SetCaptureMuted(output_will_be_muted_);
}
return kNoError;
}
int AudioProcessingImpl::InitializeTransient() {
void AudioProcessingImpl::InitializeTransient() {
if (transient_suppressor_enabled_) {
if (!transient_suppressor_.get()) {
transient_suppressor_.reset(new TransientSuppressor());
@ -980,7 +975,6 @@ int AudioProcessingImpl::InitializeTransient() {
split_rate_,
fwd_out_format_.num_channels());
}
return kNoError;
}
void AudioProcessingImpl::InitializeBeamformer() {