Add a CreateNetEq method that takes an AudioDecoderFactory

The NetEqFactory is currently expected to wrap the AudioDecoderFactory,
but this turns out not to be a good idea. Instead, it makes more sense
to pass the AudioDecoderFactory through the CreateNetEq method.

Bug: webrtc:11005
Change-Id: I8027ff6593f40c92072e7e88157631dcf329a984
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160644
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29918}
diff --git a/modules/audio_coding/acm2/acm_receiver.cc b/modules/audio_coding/acm2/acm_receiver.cc
index 9783fc8..9cecb98 100644
--- a/modules/audio_coding/acm2/acm_receiver.cc
+++ b/modules/audio_coding/acm2/acm_receiver.cc
@@ -19,11 +19,10 @@
 #include "absl/strings/match.h"
 #include "api/audio/audio_frame.h"
 #include "api/audio_codecs/audio_decoder.h"
-#include "api/neteq/custom_neteq_factory.h"
-#include "api/neteq/default_neteq_controller_factory.h"
 #include "api/neteq/neteq.h"
 #include "modules/audio_coding/acm2/acm_resampler.h"
 #include "modules/audio_coding/acm2/call_statistics.h"
+#include "modules/audio_coding/neteq/default_neteq_factory.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/numerics/safe_conversions.h"
@@ -41,16 +40,10 @@
     const NetEq::Config& config,
     Clock* clock,
     const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory) {
-  RTC_CHECK((neteq_factory == nullptr) || (decoder_factory.get() == nullptr))
-      << "Either a NetEqFactory or a AudioDecoderFactory should be injected, "
-         "supplying both is not supported. Please wrap the AudioDecoderFactory "
-         "inside the NetEqFactory when using both.";
   if (neteq_factory) {
-    return neteq_factory->CreateNetEq(config, clock);
+    return neteq_factory->CreateNetEq(config, decoder_factory, clock);
   }
-  CustomNetEqFactory custom_factory(
-      decoder_factory, std::make_unique<DefaultNetEqControllerFactory>());
-  return custom_factory.CreateNetEq(config, clock);
+  return DefaultNetEqFactory().CreateNetEq(config, decoder_factory, clock);
 }
 
 }  // namespace