Add explicit initialization for the FilterAnalyzer in AEC3

This CL adds explicit initialization of the FilterAnalyzer in AEC3.
While the current code never uses any fields before they are initialized,
it makes sense to be on the safe side and add initialization during
construction.

Bug: webrtc:11918
Change-Id: I467c4c8b8d6dd859a1b216baef28ac1e9d3f76c2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/183764
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32069}
This commit is contained in:
Per Åhgren
2020-09-10 09:29:42 +02:00
committed by Commit Bot
parent fb39998140
commit 2f0f93a0c9
2 changed files with 14 additions and 5 deletions

View File

@ -69,9 +69,7 @@ void FilterAnalyzer::Reset() {
blocks_since_reset_ = 0;
ResetRegion();
for (auto& state : filter_analysis_states_) {
state.peak_index = 0;
state.gain = default_gain_;
state.consistent_filter_detector.Reset();
state.Reset(default_gain_);
}
std::fill(filter_delays_blocks_.begin(), filter_delays_blocks_.end(), 0);
}
@ -204,7 +202,9 @@ FilterAnalyzer::ConsistentFilterDetector::ConsistentFilterDetector(
const EchoCanceller3Config& config)
: active_render_threshold_(config.render_levels.active_render_limit *
config.render_levels.active_render_limit *
kFftLengthBy2) {}
kFftLengthBy2) {
Reset();
}
void FilterAnalyzer::ConsistentFilterDetector::Reset() {
significant_peak_ = false;

View File

@ -112,7 +112,16 @@ class FilterAnalyzer {
struct FilterAnalysisState {
explicit FilterAnalysisState(const EchoCanceller3Config& config)
: filter_length_blocks(config.filter.refined_initial.length_blocks),
consistent_filter_detector(config) {}
consistent_filter_detector(config) {
Reset(config.ep_strength.default_gain);
}
void Reset(float default_gain) {
peak_index = 0;
gain = default_gain;
consistent_filter_detector.Reset();
}
float gain;
size_t peak_index;
int filter_length_blocks;