| 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.h" | 13 #include "base/threading/thread.h" |
| 13 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 14 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 16 #include "remoting/protocol/port_allocator_factory_interface.h" |
| 15 #include "remoting/protocol/transport.h" | 17 #include "remoting/protocol/transport.h" |
| 16 #include "remoting/protocol/webrtc_data_stream_adapter.h" | 18 #include "remoting/protocol/webrtc_data_stream_adapter.h" |
| 17 #include "remoting/signaling/signal_strategy.h" | 19 #include "remoting/signaling/signal_strategy.h" |
| 18 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" | 20 #include "third_party/libjingle/source/talk/app/webrtc/peerconnectioninterface.h
" |
| 19 | 21 |
| 20 namespace webrtc { | 22 namespace webrtc { |
| 21 class FakeAudioDeviceModule; | 23 class FakeAudioDeviceModule; |
| 22 } // namespace webrtc | 24 } // namespace webrtc |
| 23 | 25 |
| 24 namespace remoting { | 26 namespace remoting { |
| 25 namespace protocol { | 27 namespace protocol { |
| 26 | 28 |
| 27 class WebrtcTransport : public Transport, | 29 class WebrtcTransport : public Transport, |
| 28 public webrtc::PeerConnectionObserver { | 30 public webrtc::PeerConnectionObserver { |
| 29 public: | 31 public: |
| 30 WebrtcTransport( | 32 WebrtcTransport( |
| 31 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 33 scoped_refptr<PortAllocatorFactoryInterface> port_allocator_factory, |
| 32 port_allocator_factory, | |
| 33 TransportRole role, | 34 TransportRole role, |
| 34 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner); | 35 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner); |
| 35 ~WebrtcTransport() override; | 36 ~WebrtcTransport() override; |
| 36 | 37 |
| 37 // Transport interface. | 38 // Transport interface. |
| 38 void Start(EventHandler* event_handler, | 39 void Start(EventHandler* event_handler, |
| 39 Authenticator* authenticator) override; | 40 Authenticator* authenticator) override; |
| 40 bool ProcessTransportInfo(buzz::XmlElement* transport_info) override; | 41 bool ProcessTransportInfo(buzz::XmlElement* transport_info) override; |
| 41 StreamChannelFactory* GetStreamChannelFactory() override; | 42 StreamChannelFactory* GetStreamChannelFactory() override; |
| 42 StreamChannelFactory* GetMultiplexedChannelFactory() override; | 43 StreamChannelFactory* GetMultiplexedChannelFactory() override; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 63 void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) override; | 64 void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) override; |
| 64 | 65 |
| 65 void EnsurePendingTransportInfoMessage(); | 66 void EnsurePendingTransportInfoMessage(); |
| 66 void SendTransportInfo(); | 67 void SendTransportInfo(); |
| 67 void AddPendingCandidatesIfPossible(); | 68 void AddPendingCandidatesIfPossible(); |
| 68 | 69 |
| 69 void Close(ErrorCode error); | 70 void Close(ErrorCode error); |
| 70 | 71 |
| 71 base::ThreadChecker thread_checker_; | 72 base::ThreadChecker thread_checker_; |
| 72 | 73 |
| 73 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 74 scoped_refptr<PortAllocatorFactoryInterface> port_allocator_factory_; |
| 74 port_allocator_factory_; | |
| 75 TransportRole role_; | 75 TransportRole role_; |
| 76 EventHandler* event_handler_ = nullptr; | 76 EventHandler* event_handler_ = nullptr; |
| 77 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner_; | 77 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner_; |
| 78 | 78 |
| 79 scoped_ptr<webrtc::FakeAudioDeviceModule> fake_audio_device_module_; | 79 scoped_ptr<webrtc::FakeAudioDeviceModule> fake_audio_device_module_; |
| 80 | 80 |
| 81 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> | 81 rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> |
| 82 peer_connection_factory_; | 82 peer_connection_factory_; |
| 83 rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; | 83 rtc::scoped_refptr<webrtc::PeerConnectionInterface> peer_connection_; |
| 84 | 84 |
| 85 scoped_ptr<buzz::XmlElement> pending_transport_info_message_; | 85 scoped_ptr<buzz::XmlElement> pending_transport_info_message_; |
| 86 base::OneShotTimer transport_info_timer_; | 86 base::OneShotTimer transport_info_timer_; |
| 87 | 87 |
| 88 ScopedVector<webrtc::IceCandidateInterface> pending_incoming_candidates_; | 88 ScopedVector<webrtc::IceCandidateInterface> pending_incoming_candidates_; |
| 89 | 89 |
| 90 std::list<rtc::scoped_refptr<webrtc::MediaStreamInterface>> | 90 std::list<rtc::scoped_refptr<webrtc::MediaStreamInterface>> |
| 91 unclaimed_streams_; | 91 unclaimed_streams_; |
| 92 | 92 |
| 93 WebrtcDataStreamAdapter data_stream_adapter_; | 93 WebrtcDataStreamAdapter data_stream_adapter_; |
| 94 | 94 |
| 95 base::WeakPtrFactory<WebrtcTransport> weak_factory_; | 95 base::WeakPtrFactory<WebrtcTransport> weak_factory_; |
| 96 | 96 |
| 97 DISALLOW_COPY_AND_ASSIGN(WebrtcTransport); | 97 DISALLOW_COPY_AND_ASSIGN(WebrtcTransport); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 class WebrtcTransportFactory : public TransportFactory { | 100 class WebrtcTransportFactory : public TransportFactory { |
| 101 public: | 101 public: |
| 102 WebrtcTransportFactory( | 102 WebrtcTransportFactory( |
| 103 SignalStrategy* signal_strategy, | 103 SignalStrategy* signal_strategy, |
| 104 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 104 scoped_refptr<PortAllocatorFactoryInterface> port_allocator_factory, |
| 105 port_allocator_factory, | |
| 106 TransportRole role); | 105 TransportRole role); |
| 107 ~WebrtcTransportFactory() override; | 106 ~WebrtcTransportFactory() override; |
| 108 | 107 |
| 109 // TransportFactory interface. | 108 // TransportFactory interface. |
| 110 scoped_ptr<Transport> CreateTransport() override; | 109 scoped_ptr<Transport> CreateTransport() override; |
| 111 | 110 |
| 112 private: | 111 private: |
| 113 SignalStrategy* signal_strategy_; | 112 SignalStrategy* signal_strategy_; |
| 114 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 113 scoped_refptr<PortAllocatorFactoryInterface> port_allocator_factory_; |
| 115 port_allocator_factory_; | |
| 116 TransportRole role_; | 114 TransportRole role_; |
| 117 | 115 |
| 118 base::Thread worker_thread_; | 116 base::Thread worker_thread_; |
| 119 | 117 |
| 120 DISALLOW_COPY_AND_ASSIGN(WebrtcTransportFactory); | 118 DISALLOW_COPY_AND_ASSIGN(WebrtcTransportFactory); |
| 121 }; | 119 }; |
| 122 | 120 |
| 123 } // namespace protocol | 121 } // namespace protocol |
| 124 } // namespace remoting | 122 } // namespace remoting |
| 125 | 123 |
| 126 #endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ | 124 #endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ |
| OLD | NEW |