Enables robust delay validation in AEC delay logging.

* Explicitly disabled robust validation in AECM.
* Updated audio_processing_unittests for using robust delay validation in AEC.
* Updated output_data_float.pb (not needed for Android nor fixed point, since AECM is untouched).

BUG=None
TESTED=modules_unittests, trybots
R=aluebs@webrtc.org, andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/6879004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5368 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_processing/aec/aec_core.c b/webrtc/modules/audio_processing/aec/aec_core.c
index bfa087c..4f4ce03 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.c
+++ b/webrtc/modules/audio_processing/aec/aec_core.c
@@ -475,6 +475,17 @@
   aec->extended_filter_enabled = 0;
   aec->num_partitions = kNormalNumPartitions;
 
+  // Update the delay estimator with filter length.  We use half the
+  // |num_partitions| to take the echo path into account.  In practice we say
+  // that the echo has a duration of maximum half |num_partitions|, which is not
+  // true, but serves as a crude measure.
+  WebRtc_set_allowed_offset(aec->delay_estimator, aec->num_partitions / 2);
+  // TODO(bjornv): I currently hard coded the enable.  Once we've established
+  // that AECM has no performance regression, robust_validation will be enabled
+  // all the time and the APIs to turn it on/off will be removed.  Hence, remove
+  // this line then.
+  WebRtc_enable_robust_validation(aec->delay_estimator, 1);
+
   // Default target suppression mode.
   aec->nlp_mode = 1;
 
@@ -771,6 +782,8 @@
 void WebRtcAec_enable_delay_correction(AecCore* self, int enable) {
   self->extended_filter_enabled = enable;
   self->num_partitions = enable ? kExtendedNumPartitions : kNormalNumPartitions;
+  // Update the delay estimator with filter length.  See InitAEC() for details.
+  WebRtc_set_allowed_offset(self->delay_estimator, self->num_partitions / 2);
 }
 
 int WebRtcAec_delay_correction_enabled(AecCore* self) {
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.c b/webrtc/modules/audio_processing/aecm/aecm_core.c
index fc94f1b..0f34874 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core.c
+++ b/webrtc/modules/audio_processing/aecm/aecm_core.c
@@ -266,6 +266,9 @@
       aecm = NULL;
       return -1;
     }
+    // TODO(bjornv): Explicitly disable robust delay validation until no
+    // performance regression has been established.  Then remove the line.
+    WebRtc_enable_robust_validation(aecm->delay_estimator, 0);
 
     aecm->real_fft = WebRtcSpl_CreateRealFFT(PART_LEN_SHIFT);
     if (aecm->real_fft == NULL) {
diff --git a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc
index 6eab1e8..6f1ee27 100644
--- a/webrtc/modules/audio_processing/test/audio_processing_unittest.cc
+++ b/webrtc/modules/audio_processing/test/audio_processing_unittest.cc
@@ -50,6 +50,8 @@
 using webrtc::VoiceDetection;
 
 namespace {
+// TODO(bjornv): This is not feasible until the functionality has been
+// re-implemented; see comment at the bottom of this file.
 // When false, this will compare the output data with the results stored to
 // file. This is the typical case. When the file should be updated, it can
 // be set to true with the command-line switch --write_ref_data.
@@ -469,10 +471,10 @@
     frame_queue.push(frame);
     frame_delay--;
   }
-  // Run for 4.5 seconds, skipping statistics from the first second. We need
-  // enough frames with audio to have reliable estimates, but as few as possible
-  // to keep processing time down. 4.5 seconds seemed to be a good compromise
-  // for this recording.
+  // Run for 4.5 seconds, skipping statistics from the first 2.5 seconds.  We
+  // need enough frames with audio to have reliable estimates, but as few as
+  // possible to keep processing time down.  4.5 seconds seemed to be a good
+  // compromise for this recording.
   for (int frame_count = 0; frame_count < 450; ++frame_count) {
     webrtc::AudioFrame* frame = new AudioFrame();
     frame->CopyFrom(tmp_frame);
@@ -496,7 +498,7 @@
     frame_queue.pop();
     delete frame;
 
-    if (frame_count == 100) {
+    if (frame_count == 250) {
       int median;
       int std;
       // Discard the first delay metrics to avoid convergence effects.