Correcting the analog AGC re-initialization at device changes
This CL corrects the re-initialization behavior of the analog AGC to work correctly when the AGC is reinitialized. Bug: webrtc:11131 Change-Id: Ie455ba3db1aa3936cbcbb2fab023528124853284 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160650 Commit-Queue: Per Åhgren <peah@webrtc.org> Reviewed-by: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29924}
This commit is contained in:
@ -482,12 +482,20 @@ int AudioProcessingImpl::InitializeLocked() {
|
|||||||
static_cast<int>(num_proc_channels()) ||
|
static_cast<int>(num_proc_channels()) ||
|
||||||
submodules_.agc_manager->sample_rate_hz() !=
|
submodules_.agc_manager->sample_rate_hz() !=
|
||||||
capture_nonlocked_.split_rate) {
|
capture_nonlocked_.split_rate) {
|
||||||
|
int stream_analog_level = -1;
|
||||||
|
const bool re_creation = !!submodules_.agc_manager;
|
||||||
|
if (re_creation) {
|
||||||
|
stream_analog_level = submodules_.agc_manager->stream_analog_level();
|
||||||
|
}
|
||||||
submodules_.agc_manager.reset(new AgcManagerDirect(
|
submodules_.agc_manager.reset(new AgcManagerDirect(
|
||||||
num_proc_channels(), constants_.agc_startup_min_volume,
|
num_proc_channels(), constants_.agc_startup_min_volume,
|
||||||
constants_.agc_clipped_level_min,
|
constants_.agc_clipped_level_min,
|
||||||
constants_.use_experimental_agc_agc2_level_estimation,
|
constants_.use_experimental_agc_agc2_level_estimation,
|
||||||
constants_.use_experimental_agc_agc2_digital_adaptive,
|
constants_.use_experimental_agc_agc2_digital_adaptive,
|
||||||
capture_nonlocked_.split_rate));
|
capture_nonlocked_.split_rate));
|
||||||
|
if (re_creation) {
|
||||||
|
submodules_.agc_manager->set_stream_analog_level(stream_analog_level);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
submodules_.agc_manager->Initialize();
|
submodules_.agc_manager->Initialize();
|
||||||
submodules_.agc_manager->SetupDigitalGainControl(
|
submodules_.agc_manager->SetupDigitalGainControl(
|
||||||
|
Reference in New Issue
Block a user