sctp: Move SctpTransportFactory to a separate file

Bug: webrtc:12614
Change-Id: Ifc0e96ed3262e6ca057cd73d736a7ac081493f53
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/214481
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33663}
diff --git a/media/BUILD.gn b/media/BUILD.gn
index f0967c8..e89322b 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -421,6 +421,8 @@
     sources = [
       "sctp/sctp_transport.cc",
       "sctp/sctp_transport.h",
+      "sctp/sctp_transport_factory.cc",
+      "sctp/sctp_transport_factory.h",
       "sctp/sctp_transport_internal.h",
     ]
   } else {
diff --git a/media/sctp/sctp_transport.h b/media/sctp/sctp_transport.h
index e357e70..cf352de 100644
--- a/media/sctp/sctp_transport.h
+++ b/media/sctp/sctp_transport.h
@@ -286,21 +286,6 @@
   RTC_DISALLOW_COPY_AND_ASSIGN(SctpTransport);
 };
 
-class SctpTransportFactory : public webrtc::SctpTransportFactoryInterface {
- public:
-  explicit SctpTransportFactory(rtc::Thread* network_thread)
-      : network_thread_(network_thread) {}
-
-  std::unique_ptr<SctpTransportInternal> CreateSctpTransport(
-      rtc::PacketTransportInternal* transport) override {
-    return std::unique_ptr<SctpTransportInternal>(
-        new SctpTransport(network_thread_, transport));
-  }
-
- private:
-  rtc::Thread* network_thread_;
-};
-
 class SctpTransportMap;
 
 }  // namespace cricket
diff --git a/media/sctp/sctp_transport_factory.cc b/media/sctp/sctp_transport_factory.cc
new file mode 100644
index 0000000..23793ca
--- /dev/null
+++ b/media/sctp/sctp_transport_factory.cc
@@ -0,0 +1,25 @@
+/*
+ *  Copyright 2021 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 "media/sctp/sctp_transport_factory.h"
+
+namespace cricket {
+
+SctpTransportFactory::SctpTransportFactory(rtc::Thread* network_thread)
+    : network_thread_(network_thread) {}
+
+std::unique_ptr<SctpTransportInternal>
+SctpTransportFactory::CreateSctpTransport(
+    rtc::PacketTransportInternal* transport) {
+  return std::unique_ptr<SctpTransportInternal>(
+      new SctpTransport(network_thread_, transport));
+}
+
+}  // namespace cricket
diff --git a/media/sctp/sctp_transport_factory.h b/media/sctp/sctp_transport_factory.h
new file mode 100644
index 0000000..92d9692
--- /dev/null
+++ b/media/sctp/sctp_transport_factory.h
@@ -0,0 +1,35 @@
+/*
+ *  Copyright (c) 2021 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 MEDIA_SCTP_SCTP_TRANSPORT_FACTORY_H_
+#define MEDIA_SCTP_SCTP_TRANSPORT_FACTORY_H_
+
+#include <memory>
+
+#include "api/transport/sctp_transport_factory_interface.h"
+#include "media/sctp/sctp_transport.h"
+#include "rtc_base/thread.h"
+
+namespace cricket {
+
+class SctpTransportFactory : public webrtc::SctpTransportFactoryInterface {
+ public:
+  explicit SctpTransportFactory(rtc::Thread* network_thread);
+
+  std::unique_ptr<SctpTransportInternal> CreateSctpTransport(
+      rtc::PacketTransportInternal* transport) override;
+
+ private:
+  rtc::Thread* network_thread_;
+};
+
+}  // namespace cricket
+
+#endif  // MEDIA_SCTP_SCTP_TRANSPORT_FACTORY_H__
diff --git a/pc/connection_context.cc b/pc/connection_context.cc
index 213a8f3..4da4bb0 100644
--- a/pc/connection_context.cc
+++ b/pc/connection_context.cc
@@ -16,6 +16,7 @@
 
 #include "api/transport/field_trial_based_config.h"
 #include "media/base/rtp_data_engine.h"
+#include "media/sctp/sctp_transport_factory.h"
 #include "rtc_base/helpers.h"
 #include "rtc_base/ref_counted_object.h"
 #include "rtc_base/task_utils/to_queued_task.h"
diff --git a/pc/sctp_transport.h b/pc/sctp_transport.h
index 4bb4274..a8bc45b 100644
--- a/pc/sctp_transport.h
+++ b/pc/sctp_transport.h
@@ -16,7 +16,6 @@
 #include "api/dtls_transport_interface.h"
 #include "api/scoped_refptr.h"
 #include "api/sctp_transport_interface.h"
-#include "media/sctp/sctp_transport.h"
 #include "media/sctp/sctp_transport_internal.h"
 #include "p2p/base/dtls_transport_internal.h"
 #include "pc/dtls_transport.h"