OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CONNECTION_TO_CLIENT_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "remoting/protocol/transport.h" | 12 #include "remoting/protocol/transport.h" |
13 | 13 |
14 namespace webrtc { | 14 namespace webrtc { |
15 class DesktopCapturer; | 15 class DesktopCapturer; |
16 } // namespace webrtc | 16 } // namespace webrtc |
17 | 17 |
18 namespace remoting { | 18 namespace remoting { |
19 | 19 |
20 class VideoEncoder; | 20 class VideoEncoder; |
21 | 21 |
22 namespace protocol { | 22 namespace protocol { |
23 | 23 |
24 class AudioStub; | 24 class AudioStream; |
| 25 class AudioSource; |
25 class ClientStub; | 26 class ClientStub; |
26 class ClipboardStub; | 27 class ClipboardStub; |
27 class HostStub; | 28 class HostStub; |
28 class InputStub; | 29 class InputStub; |
29 class Session; | 30 class Session; |
30 class VideoStream; | 31 class VideoStream; |
31 | 32 |
32 // This interface represents a remote viewer connection to the chromoting host. | 33 // This interface represents a remote viewer connection to the chromoting host. |
33 // It sets up all protocol channels and connects them to the stubs. | 34 // It sets up all protocol channels and connects them to the stubs. |
34 class ConnectionToClient { | 35 class ConnectionToClient { |
35 public: | 36 public: |
36 class EventHandler { | 37 class EventHandler { |
37 public: | 38 public: |
38 // Called when the network connection is authenticating | 39 // Called when the network connection is authenticating |
39 virtual void OnConnectionAuthenticating(ConnectionToClient* connection) = 0; | 40 virtual void OnConnectionAuthenticating(ConnectionToClient* connection) = 0; |
40 | 41 |
41 // Called when the network connection is authenticated. | 42 // Called when the network connection is authenticated. |
42 virtual void OnConnectionAuthenticated(ConnectionToClient* connection) = 0; | 43 virtual void OnConnectionAuthenticated(ConnectionToClient* connection) = 0; |
43 | 44 |
44 // Called to request creation of video streams. May be called before or | 45 // Called to request creation of video streams. May be called before or |
45 // after OnConnectionChannelsConnected(). | 46 // after OnConnectionChannelsConnected(). |
46 virtual void CreateVideoStreams(ConnectionToClient* connection) = 0; | 47 virtual void CreateMediaStreams(ConnectionToClient* connection) = 0; |
47 | 48 |
48 // Called when the network connection is authenticated and all | 49 // Called when the network connection is authenticated and all |
49 // channels are connected. | 50 // channels are connected. |
50 virtual void OnConnectionChannelsConnected( | 51 virtual void OnConnectionChannelsConnected( |
51 ConnectionToClient* connection) = 0; | 52 ConnectionToClient* connection) = 0; |
52 | 53 |
53 // Called when the network connection is closed or failed. | 54 // Called when the network connection is closed or failed. |
54 virtual void OnConnectionClosed(ConnectionToClient* connection, | 55 virtual void OnConnectionClosed(ConnectionToClient* connection, |
55 ErrorCode error) = 0; | 56 ErrorCode error) = 0; |
56 | 57 |
(...skipping 27 matching lines...) Expand all Loading... |
84 | 85 |
85 // Callback for HostEventDispatcher to be called with a timestamp for each | 86 // Callback for HostEventDispatcher to be called with a timestamp for each |
86 // received event. | 87 // received event. |
87 virtual void OnInputEventReceived(int64_t timestamp) = 0; | 88 virtual void OnInputEventReceived(int64_t timestamp) = 0; |
88 | 89 |
89 // Start video stream that sends screen content from |desktop_capturer| to the | 90 // Start video stream that sends screen content from |desktop_capturer| to the |
90 // client. | 91 // client. |
91 virtual std::unique_ptr<VideoStream> StartVideoStream( | 92 virtual std::unique_ptr<VideoStream> StartVideoStream( |
92 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) = 0; | 93 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) = 0; |
93 | 94 |
94 // Get the stubs used by the host to transmit messages to the client. | 95 // Starts an audio stream. Returns nullptr if audio is not supported by the |
95 // The stubs must not be accessed before OnConnectionAuthenticated(), or | 96 // client. |
| 97 virtual std::unique_ptr<AudioStream> StartAudioStream( |
| 98 std::unique_ptr<AudioSource> audio_source) = 0; |
| 99 |
| 100 // The client stubs used by the host to send control messages to the client. |
| 101 // The stub must not be accessed before OnConnectionAuthenticated(), or |
96 // after OnConnectionClosed(). | 102 // after OnConnectionClosed(). |
97 // Note that the audio stub will be nullptr if audio is not enabled. | |
98 virtual AudioStub* audio_stub() = 0; | |
99 virtual ClientStub* client_stub() = 0; | 103 virtual ClientStub* client_stub() = 0; |
100 | 104 |
101 // Set the stubs which will handle messages we receive from the client. These | 105 // Set the stubs which will handle messages we receive from the client. These |
102 // must be called in EventHandler::OnConnectionAuthenticated(). | 106 // must be called in EventHandler::OnConnectionAuthenticated(). |
103 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub) = 0; | 107 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub) = 0; |
104 virtual void set_host_stub(HostStub* host_stub) = 0; | 108 virtual void set_host_stub(HostStub* host_stub) = 0; |
105 virtual void set_input_stub(InputStub* input_stub) = 0; | 109 virtual void set_input_stub(InputStub* input_stub) = 0; |
106 }; | 110 }; |
107 | 111 |
108 } // namespace protocol | 112 } // namespace protocol |
109 } // namespace remoting | 113 } // namespace remoting |
110 | 114 |
111 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 115 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |