• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2019 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 "p2p/base/default_ice_transport_factory.h"
12 
13 #include <utility>
14 
15 #include "p2p/base/basic_ice_controller.h"
16 #include "p2p/base/ice_controller_factory_interface.h"
17 
18 namespace {
19 
20 class BasicIceControllerFactory
21     : public cricket::IceControllerFactoryInterface {
22  public:
Create(const cricket::IceControllerFactoryArgs & args)23   std::unique_ptr<cricket::IceControllerInterface> Create(
24       const cricket::IceControllerFactoryArgs& args) override {
25     return std::make_unique<cricket::BasicIceController>(args);
26   }
27 };
28 
29 }  // namespace
30 
31 namespace webrtc {
32 
DefaultIceTransport(std::unique_ptr<cricket::P2PTransportChannel> internal)33 DefaultIceTransport::DefaultIceTransport(
34     std::unique_ptr<cricket::P2PTransportChannel> internal)
35     : internal_(std::move(internal)) {}
36 
~DefaultIceTransport()37 DefaultIceTransport::~DefaultIceTransport() {
38   RTC_DCHECK_RUN_ON(&thread_checker_);
39 }
40 
41 rtc::scoped_refptr<IceTransportInterface>
CreateIceTransport(const std::string & transport_name,int component,IceTransportInit init)42 DefaultIceTransportFactory::CreateIceTransport(
43     const std::string& transport_name,
44     int component,
45     IceTransportInit init) {
46   BasicIceControllerFactory factory;
47   return new rtc::RefCountedObject<DefaultIceTransport>(
48       std::make_unique<cricket::P2PTransportChannel>(
49           transport_name, component, init.port_allocator(),
50           init.async_resolver_factory(), init.event_log(), &factory));
51 }
52 
53 }  // namespace webrtc
54