Use low cut filtering whenever NS or AEC are enabled

These submodules implicitly rely on low cut filtering being enabled.

This CL clarifies a distinction:
High pass filtering is a feature that users can enable, according to the WebRTC standard.
Low cut filtering is a processing effect that is applied when any of the following is active:
- high pass filter
- noise suppression
- builtin echo cancellation

Bug: webrtc:9535
Change-Id: I9474276fb11354ea3b01e65a0699f6c29263770b
Reviewed-on: https://webrtc-review.googlesource.com/102600
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24892}
This commit is contained in:
Sam Zackrisson
2018-09-28 14:15:09 +02:00
committed by Commit Bot
parent 7e4ee6eb86
commit cb1b55612c
3 changed files with 15 additions and 30 deletions

View File

@ -154,7 +154,7 @@ AudioProcessingImpl::ApmSubmoduleStates::ApmSubmoduleStates(
capture_analyzer_enabled_(capture_analyzer_enabled) {}
bool AudioProcessingImpl::ApmSubmoduleStates::Update(
bool low_cut_filter_enabled,
bool high_pass_filter_enabled,
bool echo_canceller_enabled,
bool mobile_echo_controller_enabled,
bool residual_echo_detector_enabled,
@ -167,7 +167,7 @@ bool AudioProcessingImpl::ApmSubmoduleStates::Update(
bool level_estimator_enabled,
bool transient_suppressor_enabled) {
bool changed = false;
changed |= (low_cut_filter_enabled != low_cut_filter_enabled_);
changed |= (high_pass_filter_enabled != high_pass_filter_enabled_);
changed |= (echo_canceller_enabled != echo_canceller_enabled_);
changed |=
(mobile_echo_controller_enabled != mobile_echo_controller_enabled_);
@ -185,7 +185,7 @@ bool AudioProcessingImpl::ApmSubmoduleStates::Update(
(voice_activity_detector_enabled != voice_activity_detector_enabled_);
changed |= (transient_suppressor_enabled != transient_suppressor_enabled_);
if (changed) {
low_cut_filter_enabled_ = low_cut_filter_enabled;
high_pass_filter_enabled_ = high_pass_filter_enabled;
echo_canceller_enabled_ = echo_canceller_enabled;
mobile_echo_controller_enabled_ = mobile_echo_controller_enabled;
residual_echo_detector_enabled_ = residual_echo_detector_enabled;
@ -211,7 +211,7 @@ bool AudioProcessingImpl::ApmSubmoduleStates::CaptureMultiBandSubModulesActive()
bool AudioProcessingImpl::ApmSubmoduleStates::CaptureMultiBandProcessingActive()
const {
return low_cut_filter_enabled_ || echo_canceller_enabled_ ||
return high_pass_filter_enabled_ || echo_canceller_enabled_ ||
mobile_echo_controller_enabled_ || noise_suppressor_enabled_ ||
adaptive_gain_controller_enabled_ || echo_controller_enabled_;
}
@ -243,6 +243,11 @@ bool AudioProcessingImpl::ApmSubmoduleStates::RenderMultiBandProcessingActive()
return false;
}
bool AudioProcessingImpl::ApmSubmoduleStates::LowCutFilteringRequired() const {
return high_pass_filter_enabled_ || echo_canceller_enabled_ ||
mobile_echo_controller_enabled_ || noise_suppressor_enabled_;
}
struct AudioProcessingImpl::ApmPublicSubmodules {
ApmPublicSubmodules() {}
// Accessed externally of APM without any lock acquired.
@ -1792,7 +1797,7 @@ void AudioProcessingImpl::InitializeTransient() {
}
void AudioProcessingImpl::InitializeLowCutFilter() {
if (config_.high_pass_filter.enabled) {
if (submodule_states_.LowCutFilteringRequired()) {
private_submodules_->low_cut_filter.reset(
new LowCutFilter(num_proc_channels(), proc_sample_rate_hz()));
} else {