APM: remove `webrtc::Config`

Remove the deprecated way of configuring APM.

Bug: webrtc:5298
Change-Id: Idcedf1fe4a121adfcf2881003579cd58ac42a2b9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/232302
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35026}
diff --git a/media/engine/webrtc_voice_engine.cc b/media/engine/webrtc_voice_engine.cc
index f1ebaf39..448ad35 100644
--- a/media/engine/webrtc_voice_engine.cc
+++ b/media/engine/webrtc_voice_engine.cc
@@ -582,8 +582,6 @@
     return true;
   }
 
-  webrtc::Config config;
-
   if (options.experimental_ns) {
     experimental_ns_ = options.experimental_ns;
   }
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index 506c821..d6ed3e2 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -19,15 +19,6 @@
   }
 }
 
-rtc_library("config") {
-  visibility = [ ":*" ]
-  sources = [
-    "include/config.cc",
-    "include/config.h",
-  ]
-  deps = [ "../../rtc_base/system:rtc_export" ]
-}
-
 rtc_library("api") {
   visibility = [ "*" ]
   sources = [
@@ -37,7 +28,6 @@
   deps = [
     ":audio_frame_view",
     ":audio_processing_statistics",
-    ":config",
     "../../api:array_view",
     "../../api:scoped_refptr",
     "../../api/audio:aec3_config",
@@ -162,7 +152,6 @@
     ":audio_frame_proxies",
     ":audio_frame_view",
     ":audio_processing_statistics",
-    ":config",
     ":high_pass_filter",
     ":optionally_built_submodule_creators",
     ":rms_level",
@@ -335,7 +324,6 @@
       sources = [
         "audio_buffer_unittest.cc",
         "audio_frame_view_unittest.cc",
-        "config_unittest.cc",
         "echo_control_mobile_unittest.cc",
         "gain_controller2_unittest.cc",
         "splitting_filter_unittest.cc",
@@ -350,7 +338,6 @@
         ":audio_frame_view",
         ":audio_processing",
         ":audioproc_test_utils",
-        ":config",
         ":high_pass_filter",
         ":mocks",
         ":voice_detection",
diff --git a/modules/audio_processing/config_unittest.cc b/modules/audio_processing/config_unittest.cc
deleted file mode 100644
index 19e9ab3..0000000
--- a/modules/audio_processing/config_unittest.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-#include "modules/audio_processing/include/config.h"
-
-#include "test/gtest.h"
-
-namespace webrtc {
-namespace {
-
-struct MyExperiment {
-  static const ConfigOptionID identifier = ConfigOptionID::kMyExperimentForTest;
-  static const int kDefaultFactor;
-  static const int kDefaultOffset;
-
-  MyExperiment() : factor(kDefaultFactor), offset(kDefaultOffset) {}
-
-  MyExperiment(int factor, int offset) : factor(factor), offset(offset) {}
-
-  int factor;
-  int offset;
-};
-
-const int MyExperiment::kDefaultFactor = 1;
-const int MyExperiment::kDefaultOffset = 2;
-
-TEST(Config, ReturnsDefaultInstanceIfNotConfigured) {
-  Config config;
-  const MyExperiment& my_exp = config.Get<MyExperiment>();
-  EXPECT_EQ(MyExperiment::kDefaultFactor, my_exp.factor);
-  EXPECT_EQ(MyExperiment::kDefaultOffset, my_exp.offset);
-}
-
-TEST(Config, ReturnOptionWhenSet) {
-  Config config;
-  config.Set<MyExperiment>(new MyExperiment(5, 1));
-  const MyExperiment& my_exp = config.Get<MyExperiment>();
-  EXPECT_EQ(5, my_exp.factor);
-  EXPECT_EQ(1, my_exp.offset);
-}
-
-TEST(Config, SetNullSetsTheOptionBackToDefault) {
-  Config config;
-  config.Set<MyExperiment>(new MyExperiment(5, 1));
-  config.Set<MyExperiment>(NULL);
-  const MyExperiment& my_exp = config.Get<MyExperiment>();
-  EXPECT_EQ(MyExperiment::kDefaultFactor, my_exp.factor);
-  EXPECT_EQ(MyExperiment::kDefaultOffset, my_exp.offset);
-}
-
-struct Algo1_CostFunction {
-  static const ConfigOptionID identifier =
-      ConfigOptionID::kAlgo1CostFunctionForTest;
-  Algo1_CostFunction() {}
-
-  virtual int cost(int x) const { return x; }
-
-  virtual ~Algo1_CostFunction() {}
-};
-
-struct SqrCost : Algo1_CostFunction {
-  virtual int cost(int x) const { return x * x; }
-};
-
-TEST(Config, SupportsPolymorphism) {
-  Config config;
-  config.Set<Algo1_CostFunction>(new SqrCost());
-  EXPECT_EQ(25, config.Get<Algo1_CostFunction>().cost(5));
-}
-}  // namespace
-}  // namespace webrtc
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index 54ca996..15dcc39 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -29,7 +29,6 @@
 #include "api/audio/echo_control.h"
 #include "api/scoped_refptr.h"
 #include "modules/audio_processing/include/audio_processing_statistics.h"
-#include "modules/audio_processing/include/config.h"
 #include "rtc_base/arraysize.h"
 #include "rtc_base/constructor_magic.h"
 #include "rtc_base/ref_count.h"
diff --git a/modules/audio_processing/include/config.cc b/modules/audio_processing/include/config.cc
deleted file mode 100644
index 14240db..0000000
--- a/modules/audio_processing/include/config.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#include "modules/audio_processing/include/config.h"
-
-namespace webrtc {
-
-Config::Config() {}
-
-Config::~Config() {
-  for (OptionMap::iterator it = options_.begin(); it != options_.end(); ++it) {
-    delete it->second;
-  }
-}
-
-}  // namespace webrtc
diff --git a/modules/audio_processing/include/config.h b/modules/audio_processing/include/config.h
deleted file mode 100644
index 5fa0490..0000000
--- a/modules/audio_processing/include/config.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef MODULES_AUDIO_PROCESSING_INCLUDE_CONFIG_H_
-#define MODULES_AUDIO_PROCESSING_INCLUDE_CONFIG_H_
-
-#include <map>
-
-#include "rtc_base/system/rtc_export.h"
-
-namespace webrtc {
-
-// Only add new values to the end of the enumeration and never remove (only
-// deprecate) to maintain binary compatibility.
-enum class ConfigOptionID {
-  kMyExperimentForTest,
-  kAlgo1CostFunctionForTest,
-  kTemporalLayersFactory,  // Deprecated
-  kNetEqCapacityConfig,    // Deprecated
-  kNetEqFastAccelerate,    // Deprecated
-  kVoicePacing,            // Deprecated
-  kExtendedFilter,         // Deprecated
-  kDelayAgnostic,          // Deprecated
-  kExperimentalAgc,        // Deprecated
-  kExperimentalNs,
-  kBeamforming,               // Deprecated
-  kIntelligibility,           // Deprecated
-  kEchoCanceller3,            // Deprecated
-  kAecRefinedAdaptiveFilter,  // Deprecated
-  kLevelControl               // Deprecated
-};
-
-// Class Config is designed to ease passing a set of options across webrtc code.
-// Options are identified by typename in order to avoid incorrect casts.
-//
-// Usage:
-// * declaring an option:
-//    struct Algo1_CostFunction {
-//      virtual float cost(int x) const { return x; }
-//      virtual ~Algo1_CostFunction() {}
-//    };
-//
-// * accessing an option:
-//    config.Get<Algo1_CostFunction>().cost(value);
-//
-// * setting an option:
-//    struct SqrCost : Algo1_CostFunction {
-//      virtual float cost(int x) const { return x*x; }
-//    };
-//    config.Set<Algo1_CostFunction>(new SqrCost());
-//
-// Note: This class is thread-compatible (like STL containers).
-class RTC_EXPORT Config {
- public:
-  // Returns the option if set or a default constructed one.
-  // Callers that access options too often are encouraged to cache the result.
-  // Returned references are owned by this.
-  //
-  // Requires std::is_default_constructible<T>
-  template <typename T>
-  const T& Get() const;
-
-  // Set the option, deleting any previous instance of the same.
-  // This instance gets ownership of the newly set value.
-  template <typename T>
-  void Set(T* value);
-
-  Config();
-  ~Config();
-
- private:
-  struct BaseOption {
-    virtual ~BaseOption() {}
-  };
-
-  template <typename T>
-  struct Option : BaseOption {
-    explicit Option(T* v) : value(v) {}
-    ~Option() { delete value; }
-    T* value;
-  };
-
-  template <typename T>
-  static ConfigOptionID identifier() {
-    return T::identifier;
-  }
-
-  // Used to instantiate a default constructed object that doesn't needs to be
-  // owned. This allows Get<T> to be implemented without requiring explicitly
-  // locks.
-  template <typename T>
-  static const T& default_value() {
-    static const T* const def = new T();
-    return *def;
-  }
-
-  typedef std::map<ConfigOptionID, BaseOption*> OptionMap;
-  OptionMap options_;
-
-  Config(const Config&);
-  void operator=(const Config&);
-};
-
-template <typename T>
-const T& Config::Get() const {
-  OptionMap::const_iterator it = options_.find(identifier<T>());
-  if (it != options_.end()) {
-    const T* t = static_cast<Option<T>*>(it->second)->value;
-    if (t) {
-      return *t;
-    }
-  }
-  return default_value<T>();
-}
-
-template <typename T>
-void Config::Set(T* value) {
-  BaseOption*& it = options_[identifier<T>()];
-  delete it;
-  it = new Option<T>(value);
-}
-}  // namespace webrtc
-
-#endif  // MODULES_AUDIO_PROCESSING_INCLUDE_CONFIG_H_