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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "third_party/webrtc/api/peerconnectioninterface.h" | 22 #include "third_party/webrtc/api/peerconnectioninterface.h" |
23 | 23 |
24 namespace webrtc { | 24 namespace webrtc { |
25 class FakeAudioDeviceModule; | 25 class FakeAudioDeviceModule; |
26 } // namespace webrtc | 26 } // namespace webrtc |
27 | 27 |
28 namespace remoting { | 28 namespace remoting { |
29 namespace protocol { | 29 namespace protocol { |
30 | 30 |
31 class TransportContext; | 31 class TransportContext; |
32 class MessageChannelFactory; | |
33 class MessagePipe; | 32 class MessagePipe; |
34 | 33 |
35 class WebrtcTransport : public Transport, | 34 class WebrtcTransport : public Transport, |
36 public webrtc::PeerConnectionObserver { | 35 public webrtc::PeerConnectionObserver { |
37 public: | 36 public: |
38 class EventHandler { | 37 class EventHandler { |
39 public: | 38 public: |
40 // Called after |peer_connection| has been created but before handshake. The | 39 // Called after |peer_connection| has been created but before handshake. The |
41 // handler should create data channels and media streams. Renegotiation will | 40 // handler should create data channels and media streams. Renegotiation will |
42 // be required in two cases after this method returns: | 41 // be required in two cases after this method returns: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 webrtc::PeerConnectionInterface* peer_connection() { | 73 webrtc::PeerConnectionInterface* peer_connection() { |
75 return peer_connection_; | 74 return peer_connection_; |
76 } | 75 } |
77 webrtc::PeerConnectionFactoryInterface* peer_connection_factory() { | 76 webrtc::PeerConnectionFactoryInterface* peer_connection_factory() { |
78 return peer_connection_factory_; | 77 return peer_connection_factory_; |
79 } | 78 } |
80 remoting::WebrtcVideoEncoderFactory* video_encoder_factory() { | 79 remoting::WebrtcVideoEncoderFactory* video_encoder_factory() { |
81 return video_encoder_factory_; | 80 return video_encoder_factory_; |
82 } | 81 } |
83 | 82 |
84 // Factory for outgoing data channels. Must be used only after the transport | 83 // Creates outgoing data channel. The channel is created in CONNECTING state. |
85 // is connected. | 84 // The caller must wait for OnMessagePipeOpen() notification before sending |
86 MessageChannelFactory* outgoing_channel_factory() { | 85 // any messages. |
87 return data_stream_adapter_.get(); | 86 std::unique_ptr<MessagePipe> CreateOutgoingChannel(const std::string& name); |
88 } | |
89 | 87 |
90 // Transport interface. | 88 // Transport interface. |
91 void Start(Authenticator* authenticator, | 89 void Start(Authenticator* authenticator, |
92 SendTransportInfoCallback send_transport_info_callback) override; | 90 SendTransportInfoCallback send_transport_info_callback) override; |
93 bool ProcessTransportInfo(buzz::XmlElement* transport_info) override; | 91 bool ProcessTransportInfo(buzz::XmlElement* transport_info) override; |
94 void Close(ErrorCode error); | 92 void Close(ErrorCode error); |
95 | 93 |
96 private: | 94 private: |
97 void OnLocalSessionDescriptionCreated( | 95 void OnLocalSessionDescriptionCreated( |
98 std::unique_ptr<webrtc::SessionDescriptionInterface> description, | 96 std::unique_ptr<webrtc::SessionDescriptionInterface> description, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 152 |
155 base::WeakPtrFactory<WebrtcTransport> weak_factory_; | 153 base::WeakPtrFactory<WebrtcTransport> weak_factory_; |
156 | 154 |
157 DISALLOW_COPY_AND_ASSIGN(WebrtcTransport); | 155 DISALLOW_COPY_AND_ASSIGN(WebrtcTransport); |
158 }; | 156 }; |
159 | 157 |
160 } // namespace protocol | 158 } // namespace protocol |
161 } // namespace remoting | 159 } // namespace remoting |
162 | 160 |
163 #endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ | 161 #endif // REMOTING_PROTOCOL_WEBRTC_TRANSPORT_H_ |
OLD | NEW |