xref: /aosp_15_r20/external/webrtc/media/sctp/sctp_transport_factory.cc (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2021 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "media/sctp/sctp_transport_factory.h"
12 
13 #include "rtc_base/system/unused.h"
14 
15 #ifdef WEBRTC_HAVE_DCSCTP
16 #include "media/sctp/dcsctp_transport.h"    // nogncheck
17 #include "system_wrappers/include/clock.h"  // nogncheck
18 #endif
19 
20 namespace cricket {
21 
SctpTransportFactory(rtc::Thread * network_thread)22 SctpTransportFactory::SctpTransportFactory(rtc::Thread* network_thread)
23     : network_thread_(network_thread) {
24   RTC_UNUSED(network_thread_);
25 }
26 
27 std::unique_ptr<SctpTransportInternal>
CreateSctpTransport(rtc::PacketTransportInternal * transport)28 SctpTransportFactory::CreateSctpTransport(
29     rtc::PacketTransportInternal* transport) {
30   std::unique_ptr<SctpTransportInternal> result;
31 #ifdef WEBRTC_HAVE_DCSCTP
32   result = std::unique_ptr<SctpTransportInternal>(new webrtc::DcSctpTransport(
33       network_thread_, transport, webrtc::Clock::GetRealTimeClock()));
34 #endif
35   return result;
36 }
37 
38 }  // namespace cricket
39