OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ | 5 #ifndef REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ |
6 #define REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ | 6 #define REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
12 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
13 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
14 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
15 #include "remoting/protocol/port_allocator_factory.h" | |
16 #include "remoting/protocol/transport.h" | 14 #include "remoting/protocol/transport.h" |
17 #include "remoting/protocol/webrtc_data_stream_adapter.h" | 15 #include "remoting/protocol/webrtc_data_stream_adapter.h" |
18 #include "remoting/signaling/signal_strategy.h" | 16 #include "remoting/signaling/signal_strategy.h" |
19 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" | 17 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" |
20 | 18 |
21 namespace webrtc { | 19 namespace webrtc { |
22 class FakeAudioDeviceModule; | 20 class FakeAudioDeviceModule; |
23 } // namespace webrtc | 21 } // namespace webrtc |
24 | 22 |
25 namespace remoting { | 23 namespace remoting { |
26 namespace protocol { | 24 namespace protocol { |
27 | 25 |
28 class WebrtcTransport : public Transport, | 26 class WebrtcTransport : public Transport, |
29 public webrtc::PeerConnectionObserver { | 27 public webrtc::PeerConnectionObserver { |
30 public: | 28 public: |
31 WebrtcTransport(rtc::Thread* worker_thread, | 29 WebrtcTransport(rtc::Thread* worker_thread, |
32 PortAllocatorFactory* port_allocator_factory, | 30 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> |
| 31 port_allocator_factory, |
33 TransportRole role); | 32 TransportRole role); |
34 ~WebrtcTransport() override; | 33 ~WebrtcTransport() override; |
35 | 34 |
36 webrtc::PeerConnectionInterface* peer_connection() { | 35 webrtc::PeerConnectionInterface* peer_connection() { |
37 return peer_connection_; | 36 return peer_connection_; |
38 } | 37 } |
39 webrtc::PeerConnectionFactoryInterface* peer_connection_factory() { | 38 webrtc::PeerConnectionFactoryInterface* peer_connection_factory() { |
40 return peer_connection_factory_; | 39 return peer_connection_factory_; |
41 } | 40 } |
42 | 41 |
(...skipping 30 matching lines...) Expand all Loading... |
73 void RequestNegotiation(); | 72 void RequestNegotiation(); |
74 void SendOffer(); | 73 void SendOffer(); |
75 void EnsurePendingTransportInfoMessage(); | 74 void EnsurePendingTransportInfoMessage(); |
76 void SendTransportInfo(); | 75 void SendTransportInfo(); |
77 void AddPendingCandidatesIfPossible(); | 76 void AddPendingCandidatesIfPossible(); |
78 | 77 |
79 void Close(ErrorCode error); | 78 void Close(ErrorCode error); |
80 | 79 |
81 base::ThreadChecker thread_checker_; | 80 base::ThreadChecker thread_checker_; |
82 | 81 |
83 PortAllocatorFactory* port_allocator_factory_; | 82 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> |
| 83 port_allocator_factory_; |
84 TransportRole role_; | 84 TransportRole role_; |
85 EventHandler* event_handler_ = nullptr; | 85 EventHandler* event_handler_ = nullptr; |
86 rtc::Thread* worker_thread_; | 86 rtc::Thread* worker_thread_; |
87 | 87 |
88 scoped_ptr<webrtc::FakeAudioDeviceModule> fake_audio_device_module_; | 88 scoped_ptr<webrtc::FakeAudioDeviceModule> fake_audio_device_module_; |
89 | 89 |
90 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> | 90 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> |
91 peer_connection_factory_; | 91 peer_connection_factory_; |
92 rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; | 92 rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; |
93 | 93 |
(...skipping 12 matching lines...) Expand all Loading... |
106 base::WeakPtrFactory<WebrtcTransport> weak_factory_; | 106 base::WeakPtrFactory<WebrtcTransport> weak_factory_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(WebrtcTransport); | 108 DISALLOW_COPY_AND_ASSIGN(WebrtcTransport); |
109 }; | 109 }; |
110 | 110 |
111 class WebrtcTransportFactory : public TransportFactory { | 111 class WebrtcTransportFactory : public TransportFactory { |
112 public: | 112 public: |
113 WebrtcTransportFactory( | 113 WebrtcTransportFactory( |
114 rtc::Thread* worker_thread, | 114 rtc::Thread* worker_thread, |
115 SignalStrategy* signal_strategy, | 115 SignalStrategy* signal_strategy, |
116 scoped_ptr<PortAllocatorFactory> port_allocator_factory, | 116 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> |
| 117 port_allocator_factory, |
117 TransportRole role); | 118 TransportRole role); |
118 ~WebrtcTransportFactory() override; | 119 ~WebrtcTransportFactory() override; |
119 | 120 |
120 // TransportFactory interface. | 121 // TransportFactory interface. |
121 scoped_ptr<Transport> CreateTransport() override; | 122 scoped_ptr<Transport> CreateTransport() override; |
122 | 123 |
123 private: | 124 private: |
124 rtc::Thread* worker_thread_; | 125 rtc::Thread* worker_thread_; |
125 SignalStrategy* signal_strategy_; | 126 SignalStrategy* signal_strategy_; |
126 scoped_ptr<PortAllocatorFactory> port_allocator_factory_; | 127 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> |
| 128 port_allocator_factory_; |
127 TransportRole role_; | 129 TransportRole role_; |
128 | 130 |
129 DISALLOW_COPY_AND_ASSIGN(WebrtcTransportFactory); | 131 DISALLOW_COPY_AND_ASSIGN(WebrtcTransportFactory); |
130 }; | 132 }; |
131 | 133 |
132 } // namespace protocol | 134 } // namespace protocol |
133 } // namespace remoting | 135 } // namespace remoting |
134 | 136 |
135 #endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ | 137 #endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ |
OLD | NEW |