| Index: webrtc/modules/audio_processing/residual_echo_detector.cc
|
| diff --git a/webrtc/modules/audio_processing/residual_echo_detector.cc b/webrtc/modules/audio_processing/residual_echo_detector.cc
|
| index e95e0894bfc5d8f735243c8fdd4d6673cfba349f..2162d9f76f61adb73c95197f690cc0fd5be90fdb 100644
|
| --- a/webrtc/modules/audio_processing/residual_echo_detector.cc
|
| +++ b/webrtc/modules/audio_processing/residual_echo_detector.cc
|
| @@ -93,9 +93,8 @@ void ResidualEchoDetector::AnalyzeCaptureAudio(
|
|
|
| // Update the covariance values and determine the new echo likelihood.
|
| echo_likelihood_ = 0.f;
|
| + size_t read_index = next_insertion_index_;
|
| for (size_t delay = 0; delay < covariances_.size(); ++delay) {
|
| - const size_t read_index =
|
| - (kLookbackFrames + next_insertion_index_ - delay) % kLookbackFrames;
|
| RTC_DCHECK_LT(read_index, render_power_.size());
|
| covariances_[delay].Update(capture_power, capture_mean,
|
| capture_std_deviation, render_power_[read_index],
|
| @@ -103,6 +102,8 @@ void ResidualEchoDetector::AnalyzeCaptureAudio(
|
| render_power_std_dev_[read_index]);
|
| echo_likelihood_ = std::max(
|
| echo_likelihood_, covariances_[delay].normalized_cross_correlation());
|
| +
|
| + read_index = read_index > 0 ? read_index - 1 : kLookbackFrames - 1;
|
| }
|
| reliability_ = (1.0f - kAlpha) * reliability_ + kAlpha * 1.0f;
|
| echo_likelihood_ *= reliability_;
|
| @@ -117,8 +118,9 @@ void ResidualEchoDetector::AnalyzeCaptureAudio(
|
| recent_likelihood_max_.Update(echo_likelihood_);
|
|
|
| // Update the next insertion index.
|
| - ++next_insertion_index_;
|
| - next_insertion_index_ %= kLookbackFrames;
|
| + next_insertion_index_ = next_insertion_index_ < (kLookbackFrames - 1)
|
| + ? next_insertion_index_ + 1
|
| + : 0;
|
| }
|
|
|
| void ResidualEchoDetector::Initialize() {
|
|
|