Move code for setting field trials from NetEqTestFactory to the main function in neteq_rtpplay.

It is problematic to set field trials more than once, so to avoid running into problems, this functionality has been placed in the main function of neteq_rtpplay.

Bug: webrtc:9667
Change-Id: Ib9b9990f30a1715b50889dbfc4d74787bcbe5dae
Reviewed-on: https://webrtc-review.googlesource.com/98541
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24673}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index c5c5713..a267894 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -344,6 +344,8 @@
       deps = [
         ":neteq_simulator_api",
         "../modules/audio_coding:neteq_test_factory",
+        "../rtc_base:checks",
+        "../rtc_base:rtc_base_approved",
         "//third_party/abseil-cpp/absl/memory",
       ]
     }
diff --git a/api/test/neteq_simulator_factory.cc b/api/test/neteq_simulator_factory.cc
index 568e8a9..88ed158 100644
--- a/api/test/neteq_simulator_factory.cc
+++ b/api/test/neteq_simulator_factory.cc
@@ -12,6 +12,8 @@
 
 #include "absl/memory/memory.h"
 #include "modules/audio_coding/neteq/tools/neteq_test_factory.h"
+#include "rtc_base/checks.h"
+#include "rtc_base/flags.h"
 
 namespace webrtc {
 namespace test {
@@ -24,7 +26,11 @@
 std::unique_ptr<NetEqSimulator> NetEqSimulatorFactory::CreateSimulator(
     int argc,
     char* argv[]) {
-  return factory_->InitializeTest(argc, argv);
+  RTC_CHECK(!rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true))
+      << "Error while parsing command-line flags";
+  RTC_CHECK_EQ(argc, 3) << "Wrong number of input arguments. Expected 3, got "
+                        << argc;
+  return factory_->InitializeTest(argv[1], argv[2]);
 }
 
 }  // namespace test