| 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" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 13 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 15 #include "remoting/protocol/port_allocator_factory.h" |
| 14 #include "remoting/protocol/transport.h" | 16 #include "remoting/protocol/transport.h" |
| 15 #include "remoting/protocol/webrtc_data_stream_adapter.h" | 17 #include "remoting/protocol/webrtc_data_stream_adapter.h" |
| 16 #include "remoting/signaling/signal_strategy.h" | 18 #include "remoting/signaling/signal_strategy.h" |
| 17 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" | 19 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" |
| 18 | 20 |
| 19 namespace webrtc { | 21 namespace webrtc { |
| 20 class FakeAudioDeviceModule; | 22 class FakeAudioDeviceModule; |
| 21 } // namespace webrtc | 23 } // namespace webrtc |
| 22 | 24 |
| 23 namespace remoting { | 25 namespace remoting { |
| 24 namespace protocol { | 26 namespace protocol { |
| 25 | 27 |
| 26 class WebrtcTransport : public Transport, | 28 class WebrtcTransport : public Transport, |
| 27 public webrtc::PeerConnectionObserver { | 29 public webrtc::PeerConnectionObserver { |
| 28 public: | 30 public: |
| 29 WebrtcTransport(rtc::Thread* worker_thread, | 31 WebrtcTransport(rtc::Thread* worker_thread, |
| 30 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 32 PortAllocatorFactory* port_allocator_factory, |
| 31 port_allocator_factory, | |
| 32 TransportRole role); | 33 TransportRole role); |
| 33 ~WebrtcTransport() override; | 34 ~WebrtcTransport() override; |
| 34 | 35 |
| 35 webrtc::PeerConnectionInterface* peer_connection() { | 36 webrtc::PeerConnectionInterface* peer_connection() { |
| 36 return peer_connection_; | 37 return peer_connection_; |
| 37 } | 38 } |
| 38 webrtc::PeerConnectionFactoryInterface* peer_connection_factory() { | 39 webrtc::PeerConnectionFactoryInterface* peer_connection_factory() { |
| 39 return peer_connection_factory_; | 40 return peer_connection_factory_; |
| 40 } | 41 } |
| 41 | 42 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 72 void RequestNegotiation(); | 73 void RequestNegotiation(); |
| 73 void SendOffer(); | 74 void SendOffer(); |
| 74 void EnsurePendingTransportInfoMessage(); | 75 void EnsurePendingTransportInfoMessage(); |
| 75 void SendTransportInfo(); | 76 void SendTransportInfo(); |
| 76 void AddPendingCandidatesIfPossible(); | 77 void AddPendingCandidatesIfPossible(); |
| 77 | 78 |
| 78 void Close(ErrorCode error); | 79 void Close(ErrorCode error); |
| 79 | 80 |
| 80 base::ThreadChecker thread_checker_; | 81 base::ThreadChecker thread_checker_; |
| 81 | 82 |
| 82 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 83 PortAllocatorFactory* port_allocator_factory_; |
| 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 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 116 scoped_ptr<PortAllocatorFactory> port_allocator_factory, |
| 117 port_allocator_factory, | |
| 118 TransportRole role); | 117 TransportRole role); |
| 119 ~WebrtcTransportFactory() override; | 118 ~WebrtcTransportFactory() override; |
| 120 | 119 |
| 121 // TransportFactory interface. | 120 // TransportFactory interface. |
| 122 scoped_ptr<Transport> CreateTransport() override; | 121 scoped_ptr<Transport> CreateTransport() override; |
| 123 | 122 |
| 124 private: | 123 private: |
| 125 rtc::Thread* worker_thread_; | 124 rtc::Thread* worker_thread_; |
| 126 SignalStrategy* signal_strategy_; | 125 SignalStrategy* signal_strategy_; |
| 127 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 126 scoped_ptr<PortAllocatorFactory> port_allocator_factory_; |
| 128 port_allocator_factory_; | |
| 129 TransportRole role_; | 127 TransportRole role_; |
| 130 | 128 |
| 131 DISALLOW_COPY_AND_ASSIGN(WebrtcTransportFactory); | 129 DISALLOW_COPY_AND_ASSIGN(WebrtcTransportFactory); |
| 132 }; | 130 }; |
| 133 | 131 |
| 134 } // namespace protocol | 132 } // namespace protocol |
| 135 } // namespace remoting | 133 } // namespace remoting |
| 136 | 134 |
| 137 #endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ | 135 #endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ |
| OLD | NEW |