Reland "[getUserMedia] Fix selection of AEC2 over AEC3 when override is not present."

This is a reland of 5ff8ab34825598b7a525cc0631a866320f9039d1

Original change's description:
> [getUserMedia] Fix selection of AEC2 over AEC3 when override is not present.
> 
> During the rewrite of select settings for getUserMedia, a check was
> introduced that verified whether the override_aec3 optional value was
> not base::nullptr. However, this is incorrect as this was not returning the
> default selection for AEC3 but rather was returning AEC2 instead. This
> CL restores the original behavior.
> 
> However, this bug made so that crrev.com/c/1402803 did not fail any test
> when the default value was switched. Hence, this CL also addresses this by
> fixing the default value assumed in the select-settings unittests.
> 
> BUG=926158
> 
> Change-Id: If0ff62607ecb227c773af94bdf2ca9410c1e59fc
> Reviewed-on: https://chromium-review.googlesource.com/c/1442912
> Commit-Queue: Armando Miraglia <armax@chromium.org>
> Reviewed-by: Guido Urdaneta <guidou@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#627156}

Bug: 926158
Change-Id: I9e11e6b21fac23c8909a6b629c368392946fa4f8
Reviewed-on: https://chromium-review.googlesource.com/c/1445878
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Commit-Queue: Armando Miraglia <armax@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#627508}(cherry picked from commit 357f9ddb751e098a1aab666ae5ae08804772d3ff)
Reviewed-on: https://chromium-review.googlesource.com/c/1449734
Cr-Commit-Position: refs/branch-heads/3683@{#135}
Cr-Branched-From: e51029943e0a38dd794b73caaf6373d5496ae783-refs/heads/master@{#625896}
diff --git a/content/renderer/media/stream/media_stream_constraints_util_audio.cc b/content/renderer/media/stream/media_stream_constraints_util_audio.cc
index 4e03611..0d7a924 100644
--- a/content/renderer/media/stream/media_stream_constraints_util_audio.cc
+++ b/content/renderer/media/stream/media_stream_constraints_util_audio.cc
@@ -514,16 +514,14 @@
     }
 
     base::Optional<bool> override_aec3 = GetOverrideAec3();
-    if (override_aec3) {
-      bool use_aec3 = override_aec3.value_or(
-          base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3));
-      if ((use_aec3 && ec_mode_allowed_values_.Contains(
-                           EchoCancellationType::kEchoCancellationAec3)) ||
-          (!use_aec3 && ec_mode_allowed_values_.Contains(
-                            EchoCancellationType::kEchoCancellationAec2))) {
-        return use_aec3 ? EchoCancellationType::kEchoCancellationAec3
-                        : EchoCancellationType::kEchoCancellationAec2;
-      }
+    bool use_aec3 = override_aec3.value_or(
+        base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3));
+    if ((use_aec3 && ec_mode_allowed_values_.Contains(
+                         EchoCancellationType::kEchoCancellationAec3)) ||
+        (!use_aec3 && ec_mode_allowed_values_.Contains(
+                          EchoCancellationType::kEchoCancellationAec2))) {
+      return use_aec3 ? EchoCancellationType::kEchoCancellationAec3
+                      : EchoCancellationType::kEchoCancellationAec2;
     }
 
     // If the previous tie breakers were not enough to determine the selected
diff --git a/content/renderer/media/stream/media_stream_constraints_util_audio_unittest.cc b/content/renderer/media/stream/media_stream_constraints_util_audio_unittest.cc
index 89b04e8..49149a2 100644
--- a/content/renderer/media/stream/media_stream_constraints_util_audio_unittest.cc
+++ b/content/renderer/media/stream/media_stream_constraints_util_audio_unittest.cc
@@ -350,7 +350,7 @@
     const auto& properties = result.audio_processing_properties();
     if (IsDeviceCapture()) {
       EXPECT_EQ(properties.echo_cancellation_type,
-                EchoCancellationType::kEchoCancellationAec2);
+                EchoCancellationType::kEchoCancellationAec3);
     } else {
       EXPECT_EQ(properties.echo_cancellation_type,
                 EchoCancellationType::kEchoCancellationDisabled);
@@ -1153,7 +1153,7 @@
       expected_echo_cancellation_type =
           has_system_echo_cancellation
               ? EchoCancellationType::kEchoCancellationSystem
-              : EchoCancellationType::kEchoCancellationAec2;
+              : EchoCancellationType::kEchoCancellationAec3;
     }
     EXPECT_EQ(expected_echo_cancellation_type,
               result.audio_processing_properties().echo_cancellation_type);
@@ -1178,7 +1178,7 @@
       expected_echo_cancellation_type =
           has_system_echo_cancellation
               ? EchoCancellationType::kEchoCancellationSystem
-              : EchoCancellationType::kEchoCancellationAec2;
+              : EchoCancellationType::kEchoCancellationAec3;
     }
     EXPECT_EQ(expected_echo_cancellation_type,
               result.audio_processing_properties().echo_cancellation_type);
@@ -1211,7 +1211,7 @@
         // only the echo_cancellation properties. The other audio processing
         // properties default to false.
         const EchoCancellationType expected_echo_cancellation_type =
-            value ? EchoCancellationType::kEchoCancellationAec2
+            value ? EchoCancellationType::kEchoCancellationAec3
                   : EchoCancellationType::kEchoCancellationDisabled;
         EXPECT_EQ(expected_echo_cancellation_type,
                   properties.echo_cancellation_type);
@@ -1329,7 +1329,7 @@
         // echo_cancellation properties. The other audio processing properties
         // use the default values.
         const EchoCancellationType expected_echo_cancellation_type =
-            value ? EchoCancellationType::kEchoCancellationAec2
+            value ? EchoCancellationType::kEchoCancellationAec3
                   : EchoCancellationType::kEchoCancellationDisabled;
         EXPECT_EQ(expected_echo_cancellation_type,
                   properties.echo_cancellation_type);
@@ -1529,7 +1529,7 @@
           if (ec_value) {
             const EchoCancellationType expected_echo_cancellation_type =
                 ec_type_value == blink::WebString()
-                    ? EchoCancellationType::kEchoCancellationAec2
+                    ? EchoCancellationType::kEchoCancellationAec3
                     : GetEchoCancellationTypeFromConstraintString(
                           ec_type_value);
             EXPECT_EQ(expected_echo_cancellation_type,
diff --git a/content/renderer/media/stream/user_media_client_impl_unittest.cc b/content/renderer/media/stream/user_media_client_impl_unittest.cc
index b2acbd2..38baa3d 100644
--- a/content/renderer/media/stream/user_media_client_impl_unittest.cc
+++ b/content/renderer/media/stream/user_media_client_impl_unittest.cc
@@ -897,7 +897,7 @@
 
   const AudioProcessingProperties& properties =
       audio_capture_settings.audio_processing_properties();
-  EXPECT_EQ(EchoCancellationType::kEchoCancellationAec2,
+  EXPECT_EQ(EchoCancellationType::kEchoCancellationAec3,
             properties.echo_cancellation_type);
   EXPECT_FALSE(properties.goog_audio_mirroring);
   EXPECT_TRUE(properties.goog_auto_gain_control);
diff --git a/third_party/blink/web_tests/fast/mediastream/MediaStreamTrack-getSettings.html b/third_party/blink/web_tests/fast/mediastream/MediaStreamTrack-getSettings.html
index da405fe..e223c52 100644
--- a/third_party/blink/web_tests/fast/mediastream/MediaStreamTrack-getSettings.html
+++ b/third_party/blink/web_tests/fast/mediastream/MediaStreamTrack-getSettings.html
@@ -34,7 +34,7 @@
                 'Noise suppression missing: ' + JSON.stringify(settings));
     assert_true('echoCancellationType' in settings,
                 'Echo cancellation type missing: ' + JSON.stringify(settings));
-    assert_in_array(settings.echoCancellationType, [ "browser", "system" ],
+    assert_in_array(settings.echoCancellationType, [ "aec3", "system" ],
                 'Echo cancellation type invalid: ' + JSON.stringify(settings));
   });
 }, 'An audio track returns the expected variables');