From 4b425aeef9cded872488aea32aa5d711be43b935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=85hgren?= Date: Tue, 31 Mar 2020 13:02:15 +0200 Subject: [PATCH] AEC3: Correct peak index at filter size reductions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: chromium:1061933 Change-Id: I70745b82de1d8878d4a789c86af6a44e652c3e9e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172420 Commit-Queue: Per Ã…hgren Reviewed-by: Sam Zackrisson Cr-Commit-Position: refs/heads/master@{#30947} --- modules/audio_processing/aec3/filter_analyzer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/audio_processing/aec3/filter_analyzer.cc b/modules/audio_processing/aec3/filter_analyzer.cc index e467862ba6..696a57c18d 100644 --- a/modules/audio_processing/aec3/filter_analyzer.cc +++ b/modules/audio_processing/aec3/filter_analyzer.cc @@ -116,12 +116,12 @@ void FilterAnalyzer::AnalyzeRegion( constexpr float kOneByBlockSize = 1.f / kBlockSize; for (size_t ch = 0; ch < filters_time_domain.size(); ++ch) { RTC_DCHECK_LT(region_.start_sample_, filters_time_domain[ch].size()); - RTC_DCHECK_LT(filter_analysis_states_[ch].peak_index, - filters_time_domain[0].size()); RTC_DCHECK_LT(region_.end_sample_, filters_time_domain[ch].size()); auto& st_ch = filter_analysis_states_[ch]; RTC_DCHECK_EQ(h_highpass_[ch].size(), filters_time_domain[ch].size()); + RTC_DCHECK_GT(h_highpass_[ch].size(), 0); + st_ch.peak_index = std::min(st_ch.peak_index, h_highpass_[ch].size() - 1); st_ch.peak_index = FindPeakIndex(h_highpass_[ch], st_ch.peak_index, region_.start_sample_,