Made the AEC3 alignment a mandatory for using the adaptive filter delay

This CL ensures that the adaptive filter delay is not used for fine
tune echo removal unless the render and capture signals have been
properly aligned.

BUG=webrtc:8189

Review-Url: https://codereview.webrtc.org/3003303002
Cr-Original-Commit-Position: refs/heads/master@{#19492}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: b1737fc198ca768abdb6c0753e4f4cda5766aff6
diff --git a/modules/audio_processing/aec3/residual_echo_estimator.cc b/modules/audio_processing/aec3/residual_echo_estimator.cc
index c5df82c..8905846 100644
--- a/modules/audio_processing/aec3/residual_echo_estimator.cc
+++ b/modules/audio_processing/aec3/residual_echo_estimator.cc
@@ -95,10 +95,10 @@
   RTC_DCHECK(R2);
 
   const rtc::Optional<size_t> delay =
-      aec_state.FilterDelay()
-          ? aec_state.FilterDelay()
-          : (aec_state.ExternalDelay() ? aec_state.ExternalDelay()
-                                       : rtc::Optional<size_t>());
+      aec_state.ExternalDelay()
+          ? (aec_state.FilterDelay() ? aec_state.FilterDelay()
+                                     : aec_state.ExternalDelay())
+          : rtc::Optional<size_t>();
 
   // Estimate the power of the stationary noise in the render signal.
   RenderNoisePower(render_buffer, &X2_noise_floor_, &X2_noise_floor_counter_);
@@ -115,7 +115,7 @@
   } else {
     // Estimate the echo generating signal power.
     std::array<float, kFftLengthBy2Plus1> X2;
-    if (aec_state.ExternalDelay() || aec_state.FilterDelay()) {
+    if (aec_state.ExternalDelay() && aec_state.FilterDelay()) {
       RTC_DCHECK(delay);
       const int delay_use = static_cast<int>(*delay);