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_,