Moving/renaming webrtc/common.h.

This file defines webrtc::Config which was mostly used by modules/audio_processing. The files webrtc/common.h, webrtc/common.cc and webrtc/test/common_unittests.cc are moved to modules/audio_processing and the few remaining uses of webrtc::Config are replaced with simpler code.

- For NetEq and pacing configuration, a VoEBase::ChannelConfig is passed to VoEBase::CreateChannel().
- Removes the need for VoiceEngine::Create(const Config& config). No need to store the webrtc::Config in VoE shared state.

BUG=webrtc:5879

Review-Url: https://codereview.webrtc.org/2307533004
Cr-Original-Commit-Position: refs/heads/master@{#14109}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 88499ecaca050be2dd21fff17140d6681c3bac95
diff --git a/BUILD.gn b/BUILD.gn
index f42cc24..f9845a3 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -325,9 +325,6 @@
 
 rtc_source_set("webrtc_common") {
   sources = [
-    "audio_sink.h",
-    "common.cc",
-    "common.h",
     "common_types.cc",
     "common_types.h",
     "config.cc",
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index 81fbdb7..b980a5e 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -159,9 +159,9 @@
   FakeAudioDevice fake_audio_device(Clock::GetRealTimeClock(), audio_filename,
                                     audio_rtp_speed);
   EXPECT_EQ(0, voe_base->Init(&fake_audio_device, nullptr, decoder_factory_));
-  Config voe_config;
-  voe_config.Set<VoicePacing>(new VoicePacing(true));
-  int send_channel_id = voe_base->CreateChannel(voe_config);
+  VoEBase::ChannelConfig config;
+  config.enable_voice_pacing = true;
+  int send_channel_id = voe_base->CreateChannel(config);
   int recv_channel_id = voe_base->CreateChannel();
 
   AudioState::Config send_audio_state_config;
diff --git a/common.gyp b/common.gyp
index e5d41da..3b5fe90 100644
--- a/common.gyp
+++ b/common.gyp
@@ -12,8 +12,6 @@
       'target_name': 'webrtc_common',
       'type': 'static_library',
       'sources': [
-        'common.cc',
-        'common.h',
         'common_types.cc',
         'common_types.h',
         'config.h',
diff --git a/common_types.h b/common_types.h
index 1ef5f91..ea040fd 100644
--- a/common_types.h
+++ b/common_types.h
@@ -52,8 +52,6 @@
 
 namespace webrtc {
 
-class Config;
-
 class RewindableStream {
  public:
   virtual ~RewindableStream() {}
diff --git a/config.h b/config.h
index d932eda..9303f54 100644
--- a/config.h
+++ b/config.h
@@ -17,7 +17,6 @@
 #include <vector>
 
 #include "webrtc/base/optional.h"
-#include "webrtc/common.h"
 #include "webrtc/common_types.h"
 #include "webrtc/typedefs.h"
 
@@ -170,35 +169,6 @@
   rtc::Optional<VideoDecoderH264Settings> h264_extra_settings;
 };
 
-// Controls the capacity of the packet buffer in NetEq. The capacity is the
-// maximum number of packets that the buffer can contain. If the limit is
-// exceeded, the buffer will be flushed. The capacity does not affect the actual
-// audio delay in the general case, since this is governed by the target buffer
-// level (calculated from the jitter profile). It is only in the rare case of
-// severe network freezes that a higher capacity will lead to a (transient)
-// increase in audio delay.
-struct NetEqCapacityConfig {
-  NetEqCapacityConfig() : enabled(false), capacity(0) {}
-  explicit NetEqCapacityConfig(int value) : enabled(true), capacity(value) {}
-  static const ConfigOptionID identifier = ConfigOptionID::kNetEqCapacityConfig;
-  bool enabled;
-  int capacity;
-};
-
-struct NetEqFastAccelerate {
-  NetEqFastAccelerate() : enabled(false) {}
-  explicit NetEqFastAccelerate(bool value) : enabled(value) {}
-  static const ConfigOptionID identifier = ConfigOptionID::kNetEqFastAccelerate;
-  bool enabled;
-};
-
-struct VoicePacing {
-  VoicePacing() : enabled(false) {}
-  explicit VoicePacing(bool value) : enabled(value) {}
-  static const ConfigOptionID identifier = ConfigOptionID::kVoicePacing;
-  bool enabled;
-};
-
 }  // namespace webrtc
 
 #endif  // WEBRTC_CONFIG_H_
diff --git a/media/engine/fakewebrtcvoiceengine.h b/media/engine/fakewebrtcvoiceengine.h
index 9b5440c..33ea7ca 100644
--- a/media/engine/fakewebrtcvoiceengine.h
+++ b/media/engine/fakewebrtcvoiceengine.h
@@ -154,7 +154,7 @@
     int associate_send_channel = -1;
     std::vector<webrtc::CodecInst> recv_codecs;
     webrtc::CodecInst send_codec;
-    int neteq_capacity = -1;
+    size_t neteq_capacity = 0;
     bool neteq_fast_accelerate = false;
   };
 
@@ -190,21 +190,6 @@
   void set_fail_create_channel(bool fail_create_channel) {
     fail_create_channel_ = fail_create_channel;
   }
-  int AddChannel(const webrtc::Config& config) {
-    if (fail_create_channel_) {
-      return -1;
-    }
-    Channel* ch = new Channel();
-    auto db = webrtc::acm2::RentACodec::Database();
-    ch->recv_codecs.assign(db.begin(), db.end());
-    if (config.Get<webrtc::NetEqCapacityConfig>().enabled) {
-      ch->neteq_capacity = config.Get<webrtc::NetEqCapacityConfig>().capacity;
-    }
-    ch->neteq_fast_accelerate =
-        config.Get<webrtc::NetEqFastAccelerate>().enabled;
-    channels_[++last_channel_] = ch;
-    return last_channel_;
-  }
 
   int GetNumSetSendCodecs() const { return num_set_send_codecs_; }
 
@@ -237,11 +222,20 @@
     return nullptr;
   }
   WEBRTC_FUNC(CreateChannel, ()) {
-    webrtc::Config empty_config;
-    return AddChannel(empty_config);
+    return CreateChannel(webrtc::VoEBase::ChannelConfig());
   }
-  WEBRTC_FUNC(CreateChannel, (const webrtc::Config& config)) {
-    return AddChannel(config);
+  WEBRTC_FUNC(CreateChannel, (const webrtc::VoEBase::ChannelConfig& config)) {
+    if (fail_create_channel_) {
+      return -1;
+    }
+    Channel* ch = new Channel();
+    auto db = webrtc::acm2::RentACodec::Database();
+    ch->recv_codecs.assign(db.begin(), db.end());
+    ch->neteq_capacity = config.acm_config.neteq_config.max_packets_in_buffer;
+    ch->neteq_fast_accelerate =
+        config.acm_config.neteq_config.enable_fast_accelerate;
+    channels_[++last_channel_] = ch;
+    return last_channel_;
   }
   WEBRTC_FUNC(DeleteChannel, (int channel)) {
     WEBRTC_CHECK_CHANNEL(channel);
@@ -547,7 +541,7 @@
   void EnableStereoChannelSwapping(bool enable) override {
     stereo_swapping_enabled_ = enable;
   }
-  int GetNetEqCapacity() const {
+  size_t GetNetEqCapacity() const {
     auto ch = channels_.find(last_channel_);
     ASSERT(ch != channels_.end());
     return ch->second->neteq_capacity;
diff --git a/media/engine/webrtcvoiceengine.cc b/media/engine/webrtcvoiceengine.cc
index 0169d5a..2992411 100644
--- a/media/engine/webrtcvoiceengine.cc
+++ b/media/engine/webrtcvoiceengine.cc
@@ -29,7 +29,6 @@
 #include "webrtc/base/stringencode.h"
 #include "webrtc/base/stringutils.h"
 #include "webrtc/base/trace_event.h"
-#include "webrtc/common.h"
 #include "webrtc/media/base/audiosource.h"
 #include "webrtc/media/base/mediaconstants.h"
 #include "webrtc/media/base/streamparams.h"
@@ -538,7 +537,7 @@
     LOG(LS_INFO) << ToString(codec);
   }
 
-  voe_config_.Set<webrtc::VoicePacing>(new webrtc::VoicePacing(true));
+  channel_config_.enable_voice_pacing = true;
 
   // Temporarily turn logging level up for the Init() call.
   webrtc::Trace::SetTraceCallback(this);
@@ -802,17 +801,14 @@
   if (options.audio_jitter_buffer_max_packets) {
     LOG(LS_INFO) << "NetEq capacity is "
                  << *options.audio_jitter_buffer_max_packets;
-    voe_config_.Set<webrtc::NetEqCapacityConfig>(
-        new webrtc::NetEqCapacityConfig(
-            *options.audio_jitter_buffer_max_packets));
+    channel_config_.acm_config.neteq_config.max_packets_in_buffer =
+        std::max(20, *options.audio_jitter_buffer_max_packets);
   }
-
   if (options.audio_jitter_buffer_fast_accelerate) {
     LOG(LS_INFO) << "NetEq fast mode? "
                  << *options.audio_jitter_buffer_fast_accelerate;
-    voe_config_.Set<webrtc::NetEqFastAccelerate>(
-        new webrtc::NetEqFastAccelerate(
-            *options.audio_jitter_buffer_fast_accelerate));
+    channel_config_.acm_config.neteq_config.enable_fast_accelerate =
+        *options.audio_jitter_buffer_fast_accelerate;
   }
 
   if (options.typing_detection) {
@@ -1076,7 +1072,7 @@
 
 int WebRtcVoiceEngine::CreateVoEChannel() {
   RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
-  return voe_wrapper_->base()->CreateChannel(voe_config_);
+  return voe_wrapper_->base()->CreateChannel(channel_config_);
 }
 
 webrtc::AudioDeviceModule* WebRtcVoiceEngine::adm() {
diff --git a/media/engine/webrtcvoiceengine.h b/media/engine/webrtcvoiceengine.h
index 6508e23..27ae593 100644
--- a/media/engine/webrtcvoiceengine.h
+++ b/media/engine/webrtcvoiceengine.h
@@ -24,7 +24,6 @@
 #include "webrtc/base/stream.h"
 #include "webrtc/base/thread_checker.h"
 #include "webrtc/call.h"
-#include "webrtc/common.h"
 #include "webrtc/config.h"
 #include "webrtc/media/base/rtputils.h"
 #include "webrtc/media/engine/webrtccommon.h"
@@ -137,7 +136,7 @@
   std::vector<AudioCodec> send_codecs_;
   std::vector<AudioCodec> recv_codecs_;
   std::vector<WebRtcVoiceMediaChannel*> channels_;
-  webrtc::Config voe_config_;
+  webrtc::VoEBase::ChannelConfig channel_config_;
   bool is_dumping_aec_ = false;
 
   webrtc::AgcConfig default_agc_config_;
diff --git a/modules/BUILD.gn b/modules/BUILD.gn
index 81241dc..2cf764f 100644
--- a/modules/BUILD.gn
+++ b/modules/BUILD.gn
@@ -322,6 +322,7 @@
       "audio_processing/beamformer/matrix_unittest.cc",
       "audio_processing/beamformer/mock_nonlinear_beamformer.h",
       "audio_processing/beamformer/nonlinear_beamformer_unittest.cc",
+      "audio_processing/config_unittest.cc",
       "audio_processing/echo_cancellation_impl_unittest.cc",
       "audio_processing/splitting_filter_unittest.cc",
       "audio_processing/transient/dyadic_decimator_unittest.cc",
diff --git a/modules/audio_coding/test/APITest.cc b/modules/audio_coding/test/APITest.cc
index 833398a..c308308 100644
--- a/modules/audio_coding/test/APITest.cc
+++ b/modules/audio_coding/test/APITest.cc
@@ -22,7 +22,6 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "webrtc/base/platform_thread.h"
 #include "webrtc/base/timeutils.h"
-#include "webrtc/common.h"
 #include "webrtc/common_types.h"
 #include "webrtc/engine_configurations.h"
 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
@@ -48,7 +47,7 @@
   }
 }
 
-APITest::APITest(const Config& config)
+APITest::APITest()
     : _acmA(AudioCodingModule::Create(1)),
       _acmB(AudioCodingModule::Create(2)),
       _channel_A2B(NULL),
diff --git a/modules/audio_coding/test/APITest.h b/modules/audio_coding/test/APITest.h
index af2a3a1..99a7201 100644
--- a/modules/audio_coding/test/APITest.h
+++ b/modules/audio_coding/test/APITest.h
@@ -23,8 +23,6 @@
 
 namespace webrtc {
 
-class Config;
-
 enum APITESTAction {
   TEST_CHANGE_CODEC_ONLY = 0,
   DTX_TEST = 1
@@ -32,7 +30,7 @@
 
 class APITest : public ACMTest {
  public:
-  explicit APITest(const Config& config);
+  APITest();
   ~APITest();
 
   void Perform();
diff --git a/modules/audio_coding/test/PacketLossTest.cc b/modules/audio_coding/test/PacketLossTest.cc
index 891471d..f6764ac 100644
--- a/modules/audio_coding/test/PacketLossTest.cc
+++ b/modules/audio_coding/test/PacketLossTest.cc
@@ -13,7 +13,6 @@
 #include <memory>
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/common.h"
 #include "webrtc/test/testsupport/fileutils.h"
 
 namespace webrtc {
diff --git a/modules/audio_coding/test/TestAllCodecs.h b/modules/audio_coding/test/TestAllCodecs.h
index 6d6f380..7df139b 100644
--- a/modules/audio_coding/test/TestAllCodecs.h
+++ b/modules/audio_coding/test/TestAllCodecs.h
@@ -20,8 +20,6 @@
 
 namespace webrtc {
 
-class Config;
-
 class TestPack : public AudioPacketizationCallback {
  public:
   TestPack();
diff --git a/modules/audio_coding/test/TestRedFec.cc b/modules/audio_coding/test/TestRedFec.cc
index 24cda11..dbb238f 100644
--- a/modules/audio_coding/test/TestRedFec.cc
+++ b/modules/audio_coding/test/TestRedFec.cc
@@ -12,7 +12,6 @@
 
 #include <assert.h>
 
-#include "webrtc/common.h"
 #include "webrtc/common_types.h"
 #include "webrtc/engine_configurations.h"
 #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
diff --git a/modules/audio_coding/test/TestRedFec.h b/modules/audio_coding/test/TestRedFec.h
index e936f75..09d9259 100644
--- a/modules/audio_coding/test/TestRedFec.h
+++ b/modules/audio_coding/test/TestRedFec.h
@@ -20,8 +20,6 @@
 
 namespace webrtc {
 
-class Config;
-
 class TestRedFec : public ACMTest {
  public:
   explicit TestRedFec();
diff --git a/modules/audio_coding/test/delay_test.cc b/modules/audio_coding/test/delay_test.cc
index 50702f9..04428d5 100644
--- a/modules/audio_coding/test/delay_test.cc
+++ b/modules/audio_coding/test/delay_test.cc
@@ -16,7 +16,6 @@
 
 #include "gflags/gflags.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/common.h"
 #include "webrtc/common_types.h"
 #include "webrtc/engine_configurations.h"
 #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
diff --git a/modules/audio_coding/test/utility.cc b/modules/audio_coding/test/utility.cc
index 89368bc..58b5a68 100644
--- a/modules/audio_coding/test/utility.cc
+++ b/modules/audio_coding/test/utility.cc
@@ -16,7 +16,6 @@
 #include <string.h>
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/common.h"
 #include "webrtc/common_types.h"
 #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
 #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
diff --git a/modules/audio_coding/test/utility.h b/modules/audio_coding/test/utility.h
index dbd398e..b6c3a7a 100644
--- a/modules/audio_coding/test/utility.h
+++ b/modules/audio_coding/test/utility.h
@@ -128,10 +128,6 @@
   uint32_t _numFrameTypes[5];
 };
 
-void UseLegacyAcm(webrtc::Config* config);
-
-void UseNewAcm(webrtc::Config* config);
-
 }  // namespace webrtc
 
 #endif  // WEBRTC_MODULES_AUDIO_CODING_TEST_UTILITY_H_
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index 71338ea..2387c2e 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -71,6 +71,8 @@
     "high_pass_filter_impl.cc",
     "high_pass_filter_impl.h",
     "include/audio_processing.h",
+    "include/config.cc",
+    "include/config.h",
     "level_controller/biquad_filter.cc",
     "level_controller/biquad_filter.h",
     "level_controller/down_sampler.cc",
diff --git a/modules/audio_processing/audio_processing.gypi b/modules/audio_processing/audio_processing.gypi
index cbd4fdf..78f133a 100644
--- a/modules/audio_processing/audio_processing.gypi
+++ b/modules/audio_processing/audio_processing.gypi
@@ -83,6 +83,8 @@
         'high_pass_filter_impl.cc',
         'high_pass_filter_impl.h',
         'include/audio_processing.h',
+        'include/config.cc',
+        'include/config.h',
         'level_controller/biquad_filter.cc',
         'level_controller/biquad_filter.h',
         'level_controller/down_sampler.cc',
diff --git a/test/common_unittest.cc b/modules/audio_processing/config_unittest.cc
similarity index 96%
rename from test/common_unittest.cc
rename to modules/audio_processing/config_unittest.cc
index a239dad..2dd9f0d 100644
--- a/test/common_unittest.cc
+++ b/modules/audio_processing/config_unittest.cc
@@ -7,7 +7,7 @@
  *  in the file PATENTS.  All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
-#include "webrtc/common.h"
+#include "webrtc/modules/audio_processing/include/config.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index 09e5d5b..44ff732 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -21,8 +21,8 @@
 
 #include "webrtc/base/arraysize.h"
 #include "webrtc/base/platform_file.h"
-#include "webrtc/common.h"
 #include "webrtc/modules/audio_processing/beamformer/array_util.h"
+#include "webrtc/modules/audio_processing/include/config.h"
 #include "webrtc/typedefs.h"
 
 namespace webrtc {
diff --git a/common.cc b/modules/audio_processing/include/config.cc
similarity index 90%
rename from common.cc
rename to modules/audio_processing/include/config.cc
index bc24818..bbbc452 100644
--- a/common.cc
+++ b/modules/audio_processing/include/config.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "webrtc/common.h"
+#include "webrtc/modules/audio_processing/include/config.h"
 
 namespace webrtc {
 
diff --git a/common.h b/modules/audio_processing/include/config.h
similarity index 90%
rename from common.h
rename to modules/audio_processing/include/config.h
index 79db50c..615e3fa 100644
--- a/common.h
+++ b/modules/audio_processing/include/config.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_COMMON_H_
-#define WEBRTC_COMMON_H_
+#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_CONFIG_H_
+#define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_CONFIG_H_
 
 #include <map>
 
@@ -23,10 +23,10 @@
 enum class ConfigOptionID {
   kMyExperimentForTest,
   kAlgo1CostFunctionForTest,
-  kTemporalLayersFactory,
-  kNetEqCapacityConfig,
-  kNetEqFastAccelerate,
-  kVoicePacing,
+  kTemporalLayersFactory,  // Deprecated
+  kNetEqCapacityConfig,  // Deprecated
+  kNetEqFastAccelerate,  // Deprecated
+  kVoicePacing,  // Deprecated
   kExtendedFilter,
   kDelayAgnostic,
   kExperimentalAgc,
@@ -128,7 +128,6 @@
   delete it;
   it = new Option<T>(value);
 }
-
 }  // namespace webrtc
 
-#endif  // WEBRTC_COMMON_H_
+#endif  // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_CONFIG_H_
diff --git a/modules/audio_processing/test/process_test.cc b/modules/audio_processing/test/process_test.cc
index 6d5b979..ad769ad 100644
--- a/modules/audio_processing/test/process_test.cc
+++ b/modules/audio_processing/test/process_test.cc
@@ -20,8 +20,8 @@
 
 #include "webrtc/base/format_macros.h"
 #include "webrtc/base/timeutils.h"
-#include "webrtc/common.h"
 #include "webrtc/modules/audio_processing/include/audio_processing.h"
+#include "webrtc/modules/audio_processing/include/config.h"
 #include "webrtc/modules/audio_processing/test/protobuf_utils.h"
 #include "webrtc/modules/audio_processing/test/test_utils.h"
 #include "webrtc/modules/include/module_common_types.h"
diff --git a/modules/modules.gyp b/modules/modules.gyp
index a8da0b7..a345ba4 100644
--- a/modules/modules.gyp
+++ b/modules/modules.gyp
@@ -245,6 +245,7 @@
             'audio_processing/beamformer/matrix_unittest.cc',
             'audio_processing/beamformer/mock_nonlinear_beamformer.h',
             'audio_processing/beamformer/nonlinear_beamformer_unittest.cc',
+            'audio_processing/config_unittest.cc',
             'audio_processing/echo_cancellation_impl_unittest.cc',
             'audio_processing/splitting_filter_unittest.cc',
             'audio_processing/transient/dyadic_decimator_unittest.cc',
diff --git a/test/BUILD.gn b/test/BUILD.gn
index 6b6a2bb..6991449 100644
--- a/test/BUILD.gn
+++ b/test/BUILD.gn
@@ -282,7 +282,6 @@
     "channel_transport/udp_socket_manager_unittest.cc",
     "channel_transport/udp_socket_wrapper_unittest.cc",
     "channel_transport/udp_transport_unittest.cc",
-    "common_unittest.cc",
     "fake_network_pipe_unittest.cc",
     "frame_generator_unittest.cc",
     "rtp_file_reader_unittest.cc",
diff --git a/test/call_test.cc b/test/call_test.cc
index a766f79..e81d947 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -8,7 +8,6 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 #include "webrtc/base/checks.h"
-#include "webrtc/common.h"
 #include "webrtc/config.h"
 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h"
 #include "webrtc/test/call_test.h"
@@ -312,9 +311,9 @@
   voe_send_.codec = VoECodec::GetInterface(voe_send_.voice_engine);
   EXPECT_EQ(0, voe_send_.base->Init(fake_send_audio_device_.get(), nullptr,
                                     decoder_factory_));
-  Config voe_config;
-  voe_config.Set<VoicePacing>(new VoicePacing(true));
-  voe_send_.channel_id = voe_send_.base->CreateChannel(voe_config);
+  VoEBase::ChannelConfig config;
+  config.enable_voice_pacing = true;
+  voe_send_.channel_id = voe_send_.base->CreateChannel(config);
   EXPECT_GE(voe_send_.channel_id, 0);
 
   voe_recv_.voice_engine = VoiceEngine::Create();
diff --git a/test/mock_voice_engine.h b/test/mock_voice_engine.h
index 469028d..abd493b 100644
--- a/test/mock_voice_engine.h
+++ b/test/mock_voice_engine.h
@@ -30,8 +30,7 @@
   // http://crbug.com/428099.
   MockVoiceEngine(
       rtc::scoped_refptr<AudioDecoderFactory> decoder_factory = nullptr)
-      : VoiceEngineImpl(new Config(), true),
-        decoder_factory_(decoder_factory) {
+      : decoder_factory_(decoder_factory) {
     // Increase ref count so this object isn't automatically deleted whenever
     // interfaces are Release():d.
     ++_ref_count;
@@ -123,7 +122,7 @@
   MOCK_METHOD0(audio_processing, AudioProcessing*());
   MOCK_METHOD0(Terminate, int());
   MOCK_METHOD0(CreateChannel, int());
-  MOCK_METHOD1(CreateChannel, int(const Config& config));
+  MOCK_METHOD1(CreateChannel, int(const ChannelConfig& config));
   MOCK_METHOD1(DeleteChannel, int(int channel));
   MOCK_METHOD1(StartReceive, int(int channel));
   MOCK_METHOD1(StopReceive, int(int channel));
diff --git a/test/test.gyp b/test/test.gyp
index fc9a2ad..7f64b77 100644
--- a/test/test.gyp
+++ b/test/test.gyp
@@ -210,7 +210,6 @@
         '<(DEPTH)/testing/gtest.gyp:gtest',
       ],
       'sources': [
-        'common_unittest.cc',
         'fake_network_pipe_unittest.cc',
         'frame_generator_unittest.cc',
         'rtp_file_reader_unittest.cc',
diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc
index baccc71..aa1c9b1 100644
--- a/video/video_quality_test.cc
+++ b/video/video_quality_test.cc
@@ -70,9 +70,9 @@
   voe->base = webrtc::VoEBase::GetInterface(voe->voice_engine);
   voe->codec = webrtc::VoECodec::GetInterface(voe->voice_engine);
   EXPECT_EQ(0, voe->base->Init(nullptr, nullptr, decoder_factory));
-  webrtc::Config voe_config;
-  voe_config.Set<webrtc::VoicePacing>(new webrtc::VoicePacing(true));
-  voe->send_channel_id = voe->base->CreateChannel(voe_config);
+  webrtc::VoEBase::ChannelConfig config;
+  config.enable_voice_pacing = true;
+  voe->send_channel_id = voe->base->CreateChannel(config);
   EXPECT_GE(voe->send_channel_id, 0);
   voe->receive_channel_id = voe->base->CreateChannel();
   EXPECT_GE(voe->receive_channel_id, 0);
diff --git a/video/video_stream_decoder.h b/video/video_stream_decoder.h
index 465c8c4..ad35557 100644
--- a/video/video_stream_decoder.h
+++ b/video/video_stream_decoder.h
@@ -28,7 +28,6 @@
 
 class CallStatsObserver;
 class ChannelStatsObserver;
-class Config;
 class EncodedImageCallback;
 class I420FrameCallback;
 class ReceiveStatisticsProxy;
diff --git a/voice_engine/channel.cc b/voice_engine/channel.cc
index 29ee301..301b5a6 100644
--- a/voice_engine/channel.cc
+++ b/voice_engine/channel.cc
@@ -21,7 +21,6 @@
 #include "webrtc/base/thread_checker.h"
 #include "webrtc/base/timeutils.h"
 #include "webrtc/call/rtc_event_log.h"
-#include "webrtc/common.h"
 #include "webrtc/config.h"
 #include "webrtc/modules/audio_device/include/audio_device.h"
 #include "webrtc/modules/audio_processing/include/audio_processing.h"
@@ -34,7 +33,6 @@
 #include "webrtc/modules/utility/include/audio_frame_operations.h"
 #include "webrtc/modules/utility/include/process_thread.h"
 #include "webrtc/system_wrappers/include/trace.h"
-#include "webrtc/voice_engine/include/voe_base.h"
 #include "webrtc/voice_engine/include/voe_external_media.h"
 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
 #include "webrtc/voice_engine/output_mixer.h"
@@ -754,13 +752,12 @@
     Channel*& channel,
     int32_t channelId,
     uint32_t instanceId,
-    const Config& config,
-    const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
+    const VoEBase::ChannelConfig& config) {
   WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
                "Channel::CreateChannel(channelId=%d, instanceId=%d)", channelId,
                instanceId);
 
-  channel = new Channel(channelId, instanceId, config, decoder_factory);
+  channel = new Channel(channelId, instanceId, config);
   if (channel == NULL) {
     WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(instanceId, channelId),
                  "Channel::CreateChannel() unable to allocate memory for"
@@ -819,8 +816,7 @@
 
 Channel::Channel(int32_t channelId,
                  uint32_t instanceId,
-                 const Config& config,
-                 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory)
+                 const VoEBase::ChannelConfig& config)
     : _instanceId(instanceId),
       _channelId(channelId),
       event_log_proxy_(new RtcEventLogProxy()),
@@ -886,27 +882,18 @@
       rtcp_observer_(new VoERtcpObserver(this)),
       network_predictor_(new NetworkPredictor(Clock::GetRealTimeClock())),
       associate_send_channel_(ChannelOwner(nullptr)),
-      pacing_enabled_(config.Get<VoicePacing>().enabled),
+      pacing_enabled_(config.enable_voice_pacing),
       feedback_observer_proxy_(new TransportFeedbackProxy()),
       seq_num_allocator_proxy_(new TransportSequenceNumberProxy()),
       rtp_packet_sender_proxy_(new RtpPacketSenderProxy()),
       retransmission_rate_limiter_(new RateLimiter(Clock::GetRealTimeClock(),
                                                    kMaxRetransmissionWindowMs)),
-      decoder_factory_(decoder_factory) {
+      decoder_factory_(config.acm_config.decoder_factory) {
   WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_instanceId, _channelId),
                "Channel::Channel() - ctor");
-  AudioCodingModule::Config acm_config;
+  AudioCodingModule::Config acm_config(config.acm_config);
   acm_config.id = VoEModuleId(instanceId, channelId);
-  if (config.Get<NetEqCapacityConfig>().enabled) {
-    // Clamping the buffer capacity at 20 packets. While going lower will
-    // probably work, it makes little sense.
-    acm_config.neteq_config.max_packets_in_buffer =
-        std::max(20, config.Get<NetEqCapacityConfig>().capacity);
-  }
-  acm_config.neteq_config.enable_fast_accelerate =
-      config.Get<NetEqFastAccelerate>().enabled;
   acm_config.neteq_config.enable_muted_state = true;
-  acm_config.decoder_factory = decoder_factory;
   audio_coding_.reset(AudioCodingModule::Create(acm_config));
 
   _outputAudioLevel.Clear();
diff --git a/voice_engine/channel.h b/voice_engine/channel.h
index 1cf49d9..307b61e 100644
--- a/voice_engine/channel.h
+++ b/voice_engine/channel.h
@@ -29,6 +29,7 @@
 #include "webrtc/modules/utility/include/file_player.h"
 #include "webrtc/modules/utility/include/file_recorder.h"
 #include "webrtc/voice_engine/include/voe_audio_processing.h"
+#include "webrtc/voice_engine/include/voe_base.h"
 #include "webrtc/voice_engine/include/voe_network.h"
 #include "webrtc/voice_engine/level_indicator.h"
 #include "webrtc/voice_engine/network_predictor.h"
@@ -42,7 +43,6 @@
 namespace webrtc {
 
 class AudioDeviceModule;
-class Config;
 class FileWrapper;
 class PacketRouter;
 class ProcessThread;
@@ -175,12 +175,10 @@
       Channel*& channel,
       int32_t channelId,
       uint32_t instanceId,
-      const Config& config,
-      const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory);
+      const VoEBase::ChannelConfig& config);
   Channel(int32_t channelId,
           uint32_t instanceId,
-          const Config& config,
-          const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory);
+          const VoEBase::ChannelConfig& config);
   int32_t Init();
   int32_t SetEngineInformation(Statistics& engineStatistics,
                                OutputMixer& outputMixer,
diff --git a/voice_engine/channel_manager.cc b/voice_engine/channel_manager.cc
index bcc22b0..b8ffe6e 100644
--- a/voice_engine/channel_manager.cc
+++ b/voice_engine/channel_manager.cc
@@ -10,7 +10,6 @@
 
 #include "webrtc/voice_engine/channel_manager.h"
 
-#include "webrtc/common.h"
 #include "webrtc/voice_engine/channel.h"
 
 namespace webrtc {
@@ -45,26 +44,13 @@
 ChannelOwner::ChannelRef::ChannelRef(class Channel* channel)
     : channel(channel), ref_count(1) {}
 
-ChannelManager::ChannelManager(uint32_t instance_id, const Config& config)
-    : instance_id_(instance_id), last_channel_id_(-1), config_(config) {}
+ChannelManager::ChannelManager(uint32_t instance_id)
+    : instance_id_(instance_id), last_channel_id_(-1) {}
 
 ChannelOwner ChannelManager::CreateChannel(
-    const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
-  return CreateChannelInternal(config_, decoder_factory);
-}
-
-ChannelOwner ChannelManager::CreateChannel(
-    const Config& external_config,
-    const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
-  return CreateChannelInternal(external_config, decoder_factory);
-}
-
-ChannelOwner ChannelManager::CreateChannelInternal(
-    const Config& config,
-    const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
+    const VoEBase::ChannelConfig& config) {
   Channel* channel;
-  Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config,
-                         decoder_factory);
+  Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config);
   ChannelOwner channel_owner(channel);
 
   rtc::CritScope crit(&lock_);
diff --git a/voice_engine/channel_manager.h b/voice_engine/channel_manager.h
index adc9d90..ae16aca 100644
--- a/voice_engine/channel_manager.h
+++ b/voice_engine/channel_manager.h
@@ -19,10 +19,10 @@
 #include "webrtc/base/scoped_ref_ptr.h"
 #include "webrtc/system_wrappers/include/atomic32.h"
 #include "webrtc/typedefs.h"
+#include "webrtc/voice_engine/include/voe_base.h"
 
 namespace webrtc {
 
-class Config;
 class AudioDecoderFactory;
 
 namespace voe {
@@ -72,7 +72,7 @@
 
 class ChannelManager {
  public:
-  ChannelManager(uint32_t instance_id, const Config& config);
+  ChannelManager(uint32_t instance_id);
 
   // Upon construction of an Iterator it will grab a copy of the channel list of
   // the ChannelManager. The iteration will then occur over this state, not the
@@ -95,16 +95,8 @@
     RTC_DISALLOW_COPY_AND_ASSIGN(Iterator);
   };
 
-  // CreateChannel will always return a valid ChannelOwner instance. The channel
-  // is created either based on internal configuration, i.e. |config_|, by
-  // calling CreateChannel(...), or using and external configuration
-  // |external_config| if the overloaded method
-  // CreateChannel(const Config& external_config, ...) is called.
-  ChannelOwner CreateChannel(
-      const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory);
-  ChannelOwner CreateChannel(
-      const Config& external_config,
-      const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory);
+  // CreateChannel will always return a valid ChannelOwner instance.
+  ChannelOwner CreateChannel(const VoEBase::ChannelConfig& config);
 
   // ChannelOwner.channel() will be NULL if channel_id is invalid or no longer
   // exists. This should be checked with ChannelOwner::IsValid().
@@ -117,11 +109,6 @@
   size_t NumOfChannels() const;
 
  private:
-  // Create a channel given a configuration, |config|.
-  ChannelOwner CreateChannelInternal(
-      const Config& config,
-      const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory);
-
   uint32_t instance_id_;
 
   Atomic32 last_channel_id_;
@@ -129,8 +116,6 @@
   rtc::CriticalSection lock_;
   std::vector<ChannelOwner> channels_;
 
-  const Config& config_;
-
   RTC_DISALLOW_COPY_AND_ASSIGN(ChannelManager);
 };
 }  // namespace voe
diff --git a/voice_engine/include/voe_base.h b/voice_engine/include/voe_base.h
index 91df7d3..751394e 100644
--- a/voice_engine/include/voe_base.h
+++ b/voice_engine/include/voe_base.h
@@ -36,6 +36,7 @@
 
 #include "webrtc/base/scoped_ref_ptr.h"
 #include "webrtc/modules/audio_coding/codecs/audio_decoder_factory.h"
+#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
 #include "webrtc/common_types.h"
 
 namespace webrtc {
@@ -43,9 +44,6 @@
 class AudioDeviceModule;
 class AudioProcessing;
 class AudioTransport;
-class Config;
-
-const int kVoEDefault = -1;
 
 // VoiceEngineObserver
 class WEBRTC_DLLEXPORT VoiceEngineObserver {
@@ -65,7 +63,6 @@
   // Creates a VoiceEngine object, which can then be used to acquire
   // sub-APIs. Returns NULL on failure.
   static VoiceEngine* Create();
-  static VoiceEngine* Create(const Config& config);
 
   // Deletes a created VoiceEngine object and releases the utilized resources.
   // Note that if there are outstanding references held via other interfaces,
@@ -99,6 +96,11 @@
 // VoEBase
 class WEBRTC_DLLEXPORT VoEBase {
  public:
+  struct ChannelConfig {
+    AudioCodingModule::Config acm_config;
+    bool enable_voice_pacing = false;
+  };
+
   // Factory for the VoEBase sub-API. Increases an internal reference
   // counter if successful. Returns NULL if the API is not supported or if
   // construction fails.
@@ -146,11 +148,13 @@
   virtual int Terminate() = 0;
 
   // Creates a new channel and allocates the required resources for it.
-  // One can use |config| to configure the channel. Currently that is used for
-  // choosing between ACM1 and ACM2, when creating Audio Coding Module.
+  // The second version accepts a |config| struct which includes an Audio Coding
+  // Module config and an option to enable voice pacing. Note that the
+  // decoder_factory member of the ACM config will be ignored (the decoder
+  // factory set through Init() will always be used).
   // Returns channel ID or -1 in case of an error.
   virtual int CreateChannel() = 0;
-  virtual int CreateChannel(const Config& config) = 0;
+  virtual int CreateChannel(const ChannelConfig& config) = 0;
 
   // Deletes an existing channel and releases the utilized resources.
   // Returns -1 in case of an error, 0 otherwise.
diff --git a/voice_engine/shared_data.cc b/voice_engine/shared_data.cc
index 7a67561..41e261b 100644
--- a/voice_engine/shared_data.cc
+++ b/voice_engine/shared_data.cc
@@ -22,9 +22,9 @@
 
 static int32_t _gInstanceCounter = 0;
 
-SharedData::SharedData(const Config& config)
+SharedData::SharedData()
     : _instanceId(++_gInstanceCounter),
-      _channelManager(_gInstanceCounter, config),
+      _channelManager(_gInstanceCounter),
       _engineStatistics(_gInstanceCounter),
       _audioDevicePtr(NULL),
       _moduleProcessThreadPtr(
diff --git a/voice_engine/shared_data.h b/voice_engine/shared_data.h
index ea84eff..0e57f9d 100644
--- a/voice_engine/shared_data.h
+++ b/voice_engine/shared_data.h
@@ -25,8 +25,6 @@
 class ProcessThread;
 
 namespace webrtc {
-class Config;
-
 namespace voe {
 
 class TransmitMixer;
@@ -77,11 +75,10 @@
 
     AudioDeviceModule::AudioLayer _audioDeviceLayer;
 
-    SharedData(const Config& config);
+    SharedData();
     virtual ~SharedData();
 };
 
 }  // namespace voe
-
 }  // namespace webrtc
 #endif // WEBRTC_VOICE_ENGINE_SHARED_DATA_H
diff --git a/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h b/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h
index b9cd9e9..1b226ff 100644
--- a/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h
+++ b/voice_engine/test/auto_test/fixtures/before_initialization_fixture.h
@@ -11,9 +11,6 @@
 #ifndef SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_H_
 #define SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_H_
 
-#include <assert.h>
-
-#include "webrtc/common.h"
 #include "webrtc/common_types.h"
 #include "webrtc/engine_configurations.h"
 #include "webrtc/voice_engine/include/voe_audio_processing.h"
@@ -65,7 +62,6 @@
   webrtc::VoEHardware*        voe_hardware_;
   webrtc::VoEExternalMedia*   voe_xmedia_;
   webrtc::VoENetEqStats*      voe_neteq_stats_;
-  webrtc::Config              config_;
 };
 
 #endif  // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_H_
diff --git a/voice_engine/voe_base_impl.cc b/voice_engine/voe_base_impl.cc
index 9c917b5..f74bdb1 100644
--- a/voice_engine/voe_base_impl.cc
+++ b/voice_engine/voe_base_impl.cc
@@ -12,7 +12,6 @@
 
 #include "webrtc/base/format_macros.h"
 #include "webrtc/base/logging.h"
-#include "webrtc/common.h"
 #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h"
 #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
@@ -355,25 +354,20 @@
 }
 
 int VoEBaseImpl::CreateChannel() {
-  rtc::CritScope cs(shared_->crit_sec());
-  if (!shared_->statistics().Initialized()) {
-    shared_->SetLastError(VE_NOT_INITED, kTraceError);
-    return -1;
-  }
-
-  voe::ChannelOwner channel_owner =
-      shared_->channel_manager().CreateChannel(decoder_factory_);
-  return InitializeChannel(&channel_owner);
+  return CreateChannel(ChannelConfig());
 }
 
-int VoEBaseImpl::CreateChannel(const Config& config) {
+int VoEBaseImpl::CreateChannel(const ChannelConfig& config) {
   rtc::CritScope cs(shared_->crit_sec());
   if (!shared_->statistics().Initialized()) {
     shared_->SetLastError(VE_NOT_INITED, kTraceError);
     return -1;
   }
+
+  ChannelConfig config_copy(config);
+  config_copy.acm_config.decoder_factory = decoder_factory_;
   voe::ChannelOwner channel_owner =
-      shared_->channel_manager().CreateChannel(config, decoder_factory_);
+      shared_->channel_manager().CreateChannel(config_copy);
   return InitializeChannel(&channel_owner);
 }
 
diff --git a/voice_engine/voe_base_impl.h b/voice_engine/voe_base_impl.h
index 93e1cf5..050e9bb 100644
--- a/voice_engine/voe_base_impl.h
+++ b/voice_engine/voe_base_impl.h
@@ -41,7 +41,7 @@
   int Terminate() override;
 
   int CreateChannel() override;
-  int CreateChannel(const Config& config) override;
+  int CreateChannel(const ChannelConfig& config) override;
   int DeleteChannel(int channel) override;
 
   int StartReceive(int channel) override;
diff --git a/voice_engine/voice_engine_impl.cc b/voice_engine/voice_engine_impl.cc
index 919d0e8..5b92d27 100644
--- a/voice_engine/voice_engine_impl.cc
+++ b/voice_engine/voice_engine_impl.cc
@@ -29,8 +29,8 @@
 // improvement here.
 static int32_t gVoiceEngineInstanceCounter = 0;
 
-VoiceEngine* GetVoiceEngine(const Config* config, bool owns_config) {
-  VoiceEngineImpl* self = new VoiceEngineImpl(config, owns_config);
+VoiceEngine* GetVoiceEngine() {
+  VoiceEngineImpl* self = new VoiceEngineImpl();
   if (self != NULL) {
     self->AddRef();  // First reference.  Released in VoiceEngine::Delete.
     gVoiceEngineInstanceCounter++;
@@ -72,12 +72,7 @@
 }
 
 VoiceEngine* VoiceEngine::Create() {
-  Config* config = new Config();
-  return GetVoiceEngine(config, true);
-}
-
-VoiceEngine* VoiceEngine::Create(const Config& config) {
-  return GetVoiceEngine(&config, false);
+  return GetVoiceEngine();
 }
 
 int VoiceEngine::SetTraceFilter(unsigned int filter) {
diff --git a/voice_engine/voice_engine_impl.h b/voice_engine/voice_engine_impl.h
index aa58007..3237001 100644
--- a/voice_engine/voice_engine_impl.h
+++ b/voice_engine/voice_engine_impl.h
@@ -83,8 +83,8 @@
 #endif
                         public VoEBaseImpl {
  public:
-  VoiceEngineImpl(const Config* config, bool owns_config)
-      : SharedData(*config),
+  VoiceEngineImpl()
+      : SharedData(),
 #ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API
         VoEAudioProcessingImpl(this),
 #endif
@@ -114,9 +114,7 @@
         VoEVolumeControlImpl(this),
 #endif
         VoEBaseImpl(this),
-        _ref_count(0),
-        own_config_(owns_config ? config : NULL) {
-  }
+        _ref_count(0) {}
   ~VoiceEngineImpl() override { assert(_ref_count.Value() == 0); }
 
   int AddRef();
@@ -132,8 +130,6 @@
  // manipulate the reference count. See: fake_voice_engine.h.
  protected:
   Atomic32 _ref_count;
- private:
-  std::unique_ptr<const Config> own_config_;
 };
 
 }  // namespace webrtc