Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Unified Diff: webrtc/modules/audio_processing/residual_echo_detector.cc

Issue 2503843004: Add a reliability term to the echo detector. (Closed)
Patch Set: Added function to set reliability directly for use in unittests. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 66b34ff10541c02550cf1f8ee65af319b3965aae..0e58b497fed0e168cc73cfa30f92e945bb2c150c 100644
--- a/webrtc/modules/audio_processing/residual_echo_detector.cc
+++ b/webrtc/modules/audio_processing/residual_echo_detector.cc
@@ -25,6 +25,7 @@ float Power(rtc::ArrayView<const float> input) {
constexpr size_t kLookbackFrames = 650;
// TODO(ivoc): Verify the size of this buffer.
constexpr size_t kRenderBufferSize = 30;
+constexpr float kAlpha = 0.001f;
} // namespace
@@ -100,6 +101,8 @@ void ResidualEchoDetector::AnalyzeCaptureAudio(
echo_likelihood_ = std::max(
echo_likelihood_, covariances_[delay].normalized_cross_correlation());
}
+ reliability_ = (1.0f - kAlpha) * reliability_ + kAlpha * 1.0f;
+ echo_likelihood_ *= reliability_;
int echo_percentage = static_cast<int>(echo_likelihood_ * 100);
RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ResidualEchoDetector.EchoLikelihood",
echo_percentage, 0, 100, 100 /* number of bins */);
@@ -121,6 +124,7 @@ void ResidualEchoDetector::Initialize() {
}
echo_likelihood_ = 0.f;
next_insertion_index_ = 0;
+ reliability_ = 0.f;
}
void ResidualEchoDetector::PackRenderAudioBuffer(

Powered by Google App Engine
This is Rietveld 408576698