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 <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
| 15 #include "remoting/protocol/audio_writer.h" |
15 #include "remoting/protocol/session.h" | 16 #include "remoting/protocol/session.h" |
16 #include "remoting/protocol/video_writer.h" | 17 #include "remoting/protocol/video_writer.h" |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 class IPEndPoint; | 20 class IPEndPoint; |
20 } // namespace net | 21 } // namespace net |
21 | 22 |
22 namespace remoting { | 23 namespace remoting { |
23 namespace protocol { | 24 namespace protocol { |
24 | 25 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Disconnect the client connection. | 77 // Disconnect the client connection. |
77 virtual void Disconnect(); | 78 virtual void Disconnect(); |
78 | 79 |
79 // Update the sequence number when received from the client. EventHandler | 80 // Update the sequence number when received from the client. EventHandler |
80 // will be called. | 81 // will be called. |
81 virtual void UpdateSequenceNumber(int64 sequence_number); | 82 virtual void UpdateSequenceNumber(int64 sequence_number); |
82 | 83 |
83 // Send encoded update stream data to the viewer. | 84 // Send encoded update stream data to the viewer. |
84 virtual VideoStub* video_stub(); | 85 virtual VideoStub* video_stub(); |
85 | 86 |
| 87 // Send audio stream data to the viewer. |
| 88 virtual AudioStub* audio_stub(); |
| 89 |
86 // Send control data to the viewer/client. | 90 // Send control data to the viewer/client. |
87 virtual ClientStub* client_stub(); | 91 virtual ClientStub* client_stub(); |
88 | 92 |
89 // Stubs for receiving data from the client. | 93 // Stubs for receiving data from the client. |
90 // These three setters should be called before Init(). | 94 // These three setters should be called before Init(). |
91 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub); | 95 virtual void set_clipboard_stub(ClipboardStub* clipboard_stub); |
92 virtual void set_host_stub(HostStub* host_stub); | 96 virtual void set_host_stub(HostStub* host_stub); |
93 virtual void set_input_stub(InputStub* input_stub); | 97 virtual void set_input_stub(InputStub* input_stub); |
94 | 98 |
95 private: | 99 private: |
96 // Callback for protocol Session. | 100 // Callback for protocol Session. |
97 void OnSessionStateChange(Session::State state); | 101 void OnSessionStateChange(Session::State state); |
98 | 102 |
99 void OnSessionRouteChange(const std::string& channel_name, | 103 void OnSessionRouteChange(const std::string& channel_name, |
100 const TransportRoute& route); | 104 const TransportRoute& route); |
101 | 105 |
102 // Callback for channel initialization. | 106 // Callback for channel initialization. |
103 void OnChannelInitialized(bool successful); | 107 void OnChannelInitialized(bool successful); |
104 | 108 |
105 void NotifyIfChannelsReady(); | 109 void NotifyIfChannelsReady(); |
106 | 110 |
107 void Close(ErrorCode error); | 111 void Close(ErrorCode error); |
108 | 112 |
109 // Stops writing in the channels. | 113 // Stops writing in the channels. |
110 void CloseChannels(); | 114 void CloseChannels(); |
111 | 115 |
| 116 // Returns true when audio stream is present. |
| 117 bool AudioEnabled(); |
| 118 |
112 // Event handler for handling events sent from this object. | 119 // Event handler for handling events sent from this object. |
113 EventHandler* handler_; | 120 EventHandler* handler_; |
114 | 121 |
115 // Stubs that are called for incoming messages. | 122 // Stubs that are called for incoming messages. |
116 ClipboardStub* clipboard_stub_; | 123 ClipboardStub* clipboard_stub_; |
117 HostStub* host_stub_; | 124 HostStub* host_stub_; |
118 InputStub* input_stub_; | 125 InputStub* input_stub_; |
119 | 126 |
120 // The libjingle channel used to send and receive data from the remote client. | 127 // The libjingle channel used to send and receive data from the remote client. |
121 scoped_ptr<Session> session_; | 128 scoped_ptr<Session> session_; |
122 | 129 |
123 scoped_ptr<HostControlDispatcher> control_dispatcher_; | 130 scoped_ptr<HostControlDispatcher> control_dispatcher_; |
124 scoped_ptr<HostEventDispatcher> event_dispatcher_; | 131 scoped_ptr<HostEventDispatcher> event_dispatcher_; |
125 scoped_ptr<VideoWriter> video_writer_; | 132 scoped_ptr<VideoWriter> video_writer_; |
| 133 scoped_ptr<AudioWriter> audio_writer_; |
126 | 134 |
127 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); | 135 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
128 }; | 136 }; |
129 | 137 |
130 } // namespace protocol | 138 } // namespace protocol |
131 } // namespace remoting | 139 } // namespace remoting |
132 | 140 |
133 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 141 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
OLD | NEW |