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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "crypto/hmac.h" | 17 #include "crypto/hmac.h" |
18 #include "remoting/protocol/transport.h" | 18 #include "remoting/protocol/transport.h" |
19 #include "remoting/protocol/webrtc_data_stream_adapter.h" | 19 #include "remoting/protocol/webrtc_data_stream_adapter.h" |
20 #include "remoting/protocol/webrtc_video_encoder_factory.h" | 20 #include "remoting/protocol/webrtc_dummy_video_encoder.h" |
21 #include "remoting/signaling/signal_strategy.h" | 21 #include "remoting/signaling/signal_strategy.h" |
22 #include "third_party/webrtc/api/peerconnectioninterface.h" | 22 #include "third_party/webrtc/api/peerconnectioninterface.h" |
23 | 23 |
24 namespace remoting { | 24 namespace remoting { |
25 namespace protocol { | 25 namespace protocol { |
26 | 26 |
27 class TransportContext; | 27 class TransportContext; |
28 class MessagePipe; | 28 class MessagePipe; |
29 | 29 |
30 class WebrtcTransport : public Transport { | 30 class WebrtcTransport : public Transport { |
(...skipping 29 matching lines...) Expand all Loading... |
60 virtual ~EventHandler() {} | 60 virtual ~EventHandler() {} |
61 }; | 61 }; |
62 | 62 |
63 WebrtcTransport(rtc::Thread* worker_thread, | 63 WebrtcTransport(rtc::Thread* worker_thread, |
64 scoped_refptr<TransportContext> transport_context, | 64 scoped_refptr<TransportContext> transport_context, |
65 EventHandler* event_handler); | 65 EventHandler* event_handler); |
66 ~WebrtcTransport() override; | 66 ~WebrtcTransport() override; |
67 | 67 |
68 webrtc::PeerConnectionInterface* peer_connection(); | 68 webrtc::PeerConnectionInterface* peer_connection(); |
69 webrtc::PeerConnectionFactoryInterface* peer_connection_factory(); | 69 webrtc::PeerConnectionFactoryInterface* peer_connection_factory(); |
70 remoting::WebrtcVideoEncoderFactory* video_encoder_factory() { | 70 WebrtcDummyVideoEncoderFactory* video_encoder_factory() { |
71 return video_encoder_factory_; | 71 return video_encoder_factory_; |
72 } | 72 } |
73 | 73 |
74 // Creates outgoing data channel. The channel is created in CONNECTING state. | 74 // Creates outgoing data channel. The channel is created in CONNECTING state. |
75 // The caller must wait for OnMessagePipeOpen() notification before sending | 75 // The caller must wait for OnMessagePipeOpen() notification before sending |
76 // any messages. | 76 // any messages. |
77 std::unique_ptr<MessagePipe> CreateOutgoingChannel(const std::string& name); | 77 std::unique_ptr<MessagePipe> CreateOutgoingChannel(const std::string& name); |
78 | 78 |
79 // Transport interface. | 79 // Transport interface. |
80 void Start(Authenticator* authenticator, | 80 void Start(Authenticator* authenticator, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 rtc::Thread* worker_thread_; | 125 rtc::Thread* worker_thread_; |
126 scoped_refptr<TransportContext> transport_context_; | 126 scoped_refptr<TransportContext> transport_context_; |
127 EventHandler* event_handler_ = nullptr; | 127 EventHandler* event_handler_ = nullptr; |
128 SendTransportInfoCallback send_transport_info_callback_; | 128 SendTransportInfoCallback send_transport_info_callback_; |
129 | 129 |
130 crypto::HMAC handshake_hmac_; | 130 crypto::HMAC handshake_hmac_; |
131 | 131 |
132 std::unique_ptr<PeerConnectionWrapper> peer_connection_wrapper_; | 132 std::unique_ptr<PeerConnectionWrapper> peer_connection_wrapper_; |
133 | 133 |
134 remoting::WebrtcVideoEncoderFactory* video_encoder_factory_; | 134 WebrtcDummyVideoEncoderFactory* video_encoder_factory_; |
135 | 135 |
136 bool negotiation_pending_ = false; | 136 bool negotiation_pending_ = false; |
137 | 137 |
138 bool connected_ = false; | 138 bool connected_ = false; |
139 | 139 |
140 std::unique_ptr<buzz::XmlElement> pending_transport_info_message_; | 140 std::unique_ptr<buzz::XmlElement> pending_transport_info_message_; |
141 base::OneShotTimer transport_info_timer_; | 141 base::OneShotTimer transport_info_timer_; |
142 | 142 |
143 ScopedVector<webrtc::IceCandidateInterface> pending_incoming_candidates_; | 143 ScopedVector<webrtc::IceCandidateInterface> pending_incoming_candidates_; |
144 | 144 |
145 base::WeakPtrFactory<WebrtcTransport> weak_factory_; | 145 base::WeakPtrFactory<WebrtcTransport> weak_factory_; |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(WebrtcTransport); | 147 DISALLOW_COPY_AND_ASSIGN(WebrtcTransport); |
148 }; | 148 }; |
149 | 149 |
150 } // namespace protocol | 150 } // namespace protocol |
151 } // namespace remoting | 151 } // namespace remoting |
152 | 152 |
153 #endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ | 153 #endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ |
OLD | NEW |