Adding a copy constructor for the Config in AudioProcessing

Bug: webrtc:11180
Change-Id: I4621f83c0441fda55d0f81606174c004668dd6c6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161325
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30015}
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index 2ec3367..ba56684 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -247,6 +247,23 @@
   // submodule resets, affecting the audio quality. Use the RuntimeSetting
   // construct for runtime configuration.
   struct RTC_EXPORT Config {
+    Config() = default;
+
+    // Explicit copy assignment implementation to avoid issues with memory
+    // sanitizer complaints in case of self-assignment.
+    // TODO(peah): Add buildflag to ensure that this is only included for memory
+    // sanitizer builds.
+    Config& operator=(const Config& config) {
+      if (this != &config) {
+        memcpy(this, &config, sizeof(*this));
+      }
+      return *this;
+    }
+
+    // Explicit copy constructor needed to avoid errors due to the above
+    // implemented copy assignment operator.
+    Config(const Config& config) { *this = config; }
+
     // Sets the properties of the audio processing pipeline.
     struct RTC_EXPORT Pipeline {
       Pipeline();
@@ -387,17 +404,6 @@
       bool enabled = false;
     } level_estimation;
 
-    // Explicit copy assignment implementation to avoid issues with memory
-    // sanitizer complaints in case of self-assignment.
-    // TODO(peah): Add buildflag to ensure that this is only included for memory
-    // sanitizer builds.
-    Config& operator=(const Config& config) {
-      if (this != &config) {
-        memcpy(this, &config, sizeof(*this));
-      }
-      return *this;
-    }
-
     std::string ToString() const;
   };