Pulling AEC divergent filter fraction.

BUG=

Review URL: https://codereview.webrtc.org/1862393002

Cr-Commit-Position: refs/heads/master@{#12279}
diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc
index 0c3fc52..c4379c6 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core.cc
@@ -1887,13 +1887,16 @@
 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 ffff8ca..71f02d6 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.h
+++ b/webrtc/modules/audio_processing/aec/aec_core.h
@@ -95,7 +95,8 @@
 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 32496ca..f963a4e 100644
--- a/webrtc/modules/audio_processing/aec/echo_cancellation.cc
+++ b/webrtc/modules/audio_processing/aec/echo_cancellation.cc
@@ -452,7 +452,8 @@
     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<int>(erl.instant);
diff --git a/webrtc/modules/audio_processing/aec/echo_cancellation.h b/webrtc/modules/audio_processing/aec/echo_cancellation.h
index 09047f1..f4b1f20 100644
--- a/webrtc/modules/audio_processing/aec/echo_cancellation.h
+++ b/webrtc/modules/audio_processing/aec/echo_cancellation.h
@@ -51,6 +51,7 @@
   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 1683911..810ea89 100644
--- a/webrtc/modules/audio_processing/echo_cancellation_impl.cc
+++ b/webrtc/modules/audio_processing/echo_cancellation_impl.cc
@@ -381,6 +381,7 @@
   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 cded93c..ad95fad 100644
--- a/webrtc/modules/audio_processing/include/audio_processing.h
+++ b/webrtc/modules/audio_processing/include/audio_processing.h
@@ -672,6 +672,10 @@
 
     // (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.