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

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

Issue 2629563003: Added a new echo likelihood stat that reports the maximum value from a previous time period. (Closed)
Patch Set: Small bugfix. Created 3 years, 11 months 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 45ef1809f03656bb57d672b66c2dd45b3efcba70..78b673ee1bb610ab80663eaf05b67dc5680b84c3 100644
--- a/webrtc/modules/audio_processing/residual_echo_detector.cc
+++ b/webrtc/modules/audio_processing/residual_echo_detector.cc
@@ -26,6 +26,8 @@ constexpr size_t kLookbackFrames = 650;
// TODO(ivoc): Verify the size of this buffer.
constexpr size_t kRenderBufferSize = 30;
constexpr float kAlpha = 0.001f;
+// 10 seconds of data, updated every 10 ms.
+constexpr size_t kAggregationBufferSize = 10 * 100;
} // namespace
@@ -36,7 +38,8 @@ ResidualEchoDetector::ResidualEchoDetector()
render_power_(kLookbackFrames),
render_power_mean_(kLookbackFrames),
render_power_std_dev_(kLookbackFrames),
- covariances_(kLookbackFrames){};
+ covariances_(kLookbackFrames),
+ recent_likelihood_max_(kAggregationBufferSize) {}
ResidualEchoDetector::~ResidualEchoDetector() = default;
@@ -107,6 +110,9 @@ void ResidualEchoDetector::AnalyzeCaptureAudio(
RTC_HISTOGRAM_COUNTS("WebRTC.Audio.ResidualEchoDetector.EchoLikelihood",
echo_percentage, 0, 100, 100 /* number of bins */);
+ // Update the buffer of recent likelihood values.
+ recent_likelihood_max_.Update(echo_likelihood_);
+
// Update the next insertion index.
++next_insertion_index_;
next_insertion_index_ %= kLookbackFrames;
@@ -119,6 +125,7 @@ void ResidualEchoDetector::Initialize() {
std::fill(render_power_std_dev_.begin(), render_power_std_dev_.end(), 0.f);
render_statistics_.Clear();
capture_statistics_.Clear();
+ recent_likelihood_max_.Clear();
for (auto& cov : covariances_) {
cov.Clear();
}
« webrtc/api/statscollector.cc ('K') | « webrtc/modules/audio_processing/residual_echo_detector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698