From 5045337133d1da4a657b99e0590eb401515163bd Mon Sep 17 00:00:00 2001 From: minyue Date: Thu, 7 Apr 2016 06:36:43 -0700 Subject: [PATCH] Pulling AEC divergent filter fraction. BUG= Review URL: https://codereview.webrtc.org/1862393002 Cr-Commit-Position: refs/heads/master@{#12279} --- webrtc/modules/audio_processing/aec/aec_core.cc | 5 ++++- webrtc/modules/audio_processing/aec/aec_core.h | 3 ++- webrtc/modules/audio_processing/aec/echo_cancellation.cc | 3 ++- webrtc/modules/audio_processing/aec/echo_cancellation.h | 1 + webrtc/modules/audio_processing/echo_cancellation_impl.cc | 1 + webrtc/modules/audio_processing/include/audio_processing.h | 4 ++++ 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc index 0c3fc523ee..c4379c6171 100644 --- a/webrtc/modules/audio_processing/aec/aec_core.cc +++ b/webrtc/modules/audio_processing/aec/aec_core.cc @@ -1887,13 +1887,16 @@ int WebRtcAec_echo_state(AecCore* self) { void WebRtcAec_GetEchoStats(AecCore* self, Stats* erl, Stats* erle, - Stats* a_nlp) { + Stats* a_nlp, + float* divergent_filter_fraction) { assert(erl != NULL); assert(erle != NULL); assert(a_nlp != NULL); *erl = self->erl; *erle = self->erle; *a_nlp = self->aNlp; + *divergent_filter_fraction = + self->divergent_filter_fraction.GetLatestFraction(); } void WebRtcAec_SetConfigCore(AecCore* self, diff --git a/webrtc/modules/audio_processing/aec/aec_core.h b/webrtc/modules/audio_processing/aec/aec_core.h index ffff8cae7e..71f02d6a3e 100644 --- a/webrtc/modules/audio_processing/aec/aec_core.h +++ b/webrtc/modules/audio_processing/aec/aec_core.h @@ -95,7 +95,8 @@ int WebRtcAec_echo_state(AecCore* self); void WebRtcAec_GetEchoStats(AecCore* self, Stats* erl, Stats* erle, - Stats* a_nlp); + Stats* a_nlp, + float* divergent_filter_fraction); #ifdef WEBRTC_AEC_DEBUG_DUMP void* WebRtcAec_far_time_buf(AecCore* self); #endif diff --git a/webrtc/modules/audio_processing/aec/echo_cancellation.cc b/webrtc/modules/audio_processing/aec/echo_cancellation.cc index 32496ca33c..f963a4e1d3 100644 --- a/webrtc/modules/audio_processing/aec/echo_cancellation.cc +++ b/webrtc/modules/audio_processing/aec/echo_cancellation.cc @@ -452,7 +452,8 @@ int WebRtcAec_GetMetrics(void* handle, AecMetrics* metrics) { return AEC_UNINITIALIZED_ERROR; } - WebRtcAec_GetEchoStats(self->aec, &erl, &erle, &a_nlp); + WebRtcAec_GetEchoStats(self->aec, &erl, &erle, &a_nlp, + &metrics->divergent_filter_fraction); // ERL metrics->erl.instant = static_cast(erl.instant); diff --git a/webrtc/modules/audio_processing/aec/echo_cancellation.h b/webrtc/modules/audio_processing/aec/echo_cancellation.h index 09047f12f1..f4b1f20ab7 100644 --- a/webrtc/modules/audio_processing/aec/echo_cancellation.h +++ b/webrtc/modules/audio_processing/aec/echo_cancellation.h @@ -51,6 +51,7 @@ typedef struct { AecLevel erl; AecLevel erle; AecLevel aNlp; + float divergent_filter_fraction; } AecMetrics; struct AecCore; diff --git a/webrtc/modules/audio_processing/echo_cancellation_impl.cc b/webrtc/modules/audio_processing/echo_cancellation_impl.cc index 168391145f..810ea89655 100644 --- a/webrtc/modules/audio_processing/echo_cancellation_impl.cc +++ b/webrtc/modules/audio_processing/echo_cancellation_impl.cc @@ -381,6 +381,7 @@ int EchoCancellationImpl::GetMetrics(Metrics* metrics) { metrics->a_nlp.maximum = my_metrics.aNlp.max; metrics->a_nlp.minimum = my_metrics.aNlp.min; + metrics->divergent_filter_fraction = my_metrics.divergent_filter_fraction; return AudioProcessing::kNoError; } diff --git a/webrtc/modules/audio_processing/include/audio_processing.h b/webrtc/modules/audio_processing/include/audio_processing.h index cded93cbfe..ad95fadb1a 100644 --- a/webrtc/modules/audio_processing/include/audio_processing.h +++ b/webrtc/modules/audio_processing/include/audio_processing.h @@ -672,6 +672,10 @@ class EchoCancellation { // (Pre non-linear processing suppression) A_NLP = 10log_10(P_echo / P_a) AudioProcessing::Statistic a_nlp; + + // Fraction of time that the AEC linear filter is divergent, in a 0.5-second + // non-overlapped aggregation window. + float divergent_filter_fraction; }; // TODO(ajm): discuss the metrics update period.