Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Side by Side Diff: remoting/host/client_session.h

Issue 1472873005: Add VideoStream interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_video_pump
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/chromoting_host_unittest.cc ('k') | remoting/host/client_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_HOST_CLIENT_SESSION_H_ 5 #ifndef REMOTING_HOST_CLIENT_SESSION_H_
6 #define REMOTING_HOST_CLIENT_SESSION_H_ 6 #define REMOTING_HOST_CLIENT_SESSION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/sequenced_task_runner_helpers.h" 12 #include "base/sequenced_task_runner_helpers.h"
13 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/timer/timer.h" 15 #include "base/timer/timer.h"
16 #include "remoting/host/client_session_control.h" 16 #include "remoting/host/client_session_control.h"
17 #include "remoting/host/gnubby_auth_handler.h" 17 #include "remoting/host/gnubby_auth_handler.h"
18 #include "remoting/host/host_extension_session_manager.h" 18 #include "remoting/host/host_extension_session_manager.h"
19 #include "remoting/host/mouse_clamping_filter.h"
20 #include "remoting/host/remote_input_filter.h" 19 #include "remoting/host/remote_input_filter.h"
21 #include "remoting/protocol/clipboard_echo_filter.h" 20 #include "remoting/protocol/clipboard_echo_filter.h"
22 #include "remoting/protocol/clipboard_filter.h" 21 #include "remoting/protocol/clipboard_filter.h"
23 #include "remoting/protocol/clipboard_stub.h" 22 #include "remoting/protocol/clipboard_stub.h"
24 #include "remoting/protocol/connection_to_client.h" 23 #include "remoting/protocol/connection_to_client.h"
25 #include "remoting/protocol/host_stub.h" 24 #include "remoting/protocol/host_stub.h"
26 #include "remoting/protocol/input_event_tracker.h" 25 #include "remoting/protocol/input_event_tracker.h"
27 #include "remoting/protocol/input_filter.h" 26 #include "remoting/protocol/input_filter.h"
28 #include "remoting/protocol/input_stub.h" 27 #include "remoting/protocol/input_stub.h"
28 #include "remoting/protocol/mouse_input_filter.h"
29 #include "remoting/protocol/pairing_registry.h" 29 #include "remoting/protocol/pairing_registry.h"
30 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" 30 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
31 31
32 namespace base { 32 namespace base {
33 class SingleThreadTaskRunner; 33 class SingleThreadTaskRunner;
34 } // namespace base 34 } // namespace base
35 35
36 namespace remoting { 36 namespace remoting {
37 37
38 class AudioPump; 38 class AudioPump;
39 class DesktopEnvironment; 39 class DesktopEnvironment;
40 class DesktopEnvironmentFactory; 40 class DesktopEnvironmentFactory;
41 class InputInjector; 41 class InputInjector;
42 class MouseShapePump; 42 class MouseShapePump;
43 class ScreenControls; 43 class ScreenControls;
44 44
45 namespace protocol {
46 class VideoFramePump;
47 } // namespace protocol
48
49 // A ClientSession keeps a reference to a connection to a client, and maintains 45 // A ClientSession keeps a reference to a connection to a client, and maintains
50 // per-client state. 46 // per-client state.
51 class ClientSession 47 class ClientSession
52 : public base::NonThreadSafe, 48 : public base::NonThreadSafe,
53 public protocol::HostStub, 49 public protocol::HostStub,
54 public protocol::ConnectionToClient::EventHandler, 50 public protocol::ConnectionToClient::EventHandler,
55 public ClientSessionControl { 51 public ClientSessionControl {
56 public: 52 public:
57 // Callback interface for passing events to the ChromotingHost. 53 // Callback interface for passing events to the ChromotingHost.
58 class EventHandler { 54 class EventHandler {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 113
118 // protocol::ConnectionToClient::EventHandler interface. 114 // protocol::ConnectionToClient::EventHandler interface.
119 void OnConnectionAuthenticating( 115 void OnConnectionAuthenticating(
120 protocol::ConnectionToClient* connection) override; 116 protocol::ConnectionToClient* connection) override;
121 void OnConnectionAuthenticated( 117 void OnConnectionAuthenticated(
122 protocol::ConnectionToClient* connection) override; 118 protocol::ConnectionToClient* connection) override;
123 void OnConnectionChannelsConnected( 119 void OnConnectionChannelsConnected(
124 protocol::ConnectionToClient* connection) override; 120 protocol::ConnectionToClient* connection) override;
125 void OnConnectionClosed(protocol::ConnectionToClient* connection, 121 void OnConnectionClosed(protocol::ConnectionToClient* connection,
126 protocol::ErrorCode error) override; 122 protocol::ErrorCode error) override;
123 void OnCreateVideoEncoder(scoped_ptr<VideoEncoder>* encoder) override;
127 void OnInputEventReceived(protocol::ConnectionToClient* connection, 124 void OnInputEventReceived(protocol::ConnectionToClient* connection,
128 int64_t timestamp) override; 125 int64_t timestamp) override;
129 void OnRouteChange(protocol::ConnectionToClient* connection, 126 void OnRouteChange(protocol::ConnectionToClient* connection,
130 const std::string& channel_name, 127 const std::string& channel_name,
131 const protocol::TransportRoute& route) override; 128 const protocol::TransportRoute& route) override;
132 129
133 // ClientSessionControl interface. 130 // ClientSessionControl interface.
134 const std::string& client_jid() const override; 131 const std::string& client_jid() const override;
135 void DisconnectSession(protocol::ErrorCode error) override; 132 void DisconnectSession(protocol::ErrorCode error) override;
136 void OnLocalMouseMoved(const webrtc::DesktopVector& position) override; 133 void OnLocalMouseMoved(const webrtc::DesktopVector& position) override;
137 void SetDisableInputs(bool disable_inputs) override; 134 void SetDisableInputs(bool disable_inputs) override;
138 void ResetVideoPipeline() override; 135 void ResetVideoPipeline() override;
139 136
140 void SetGnubbyAuthHandlerForTesting(GnubbyAuthHandler* gnubby_auth_handler); 137 void SetGnubbyAuthHandlerForTesting(GnubbyAuthHandler* gnubby_auth_handler);
141 138
142 protocol::ConnectionToClient* connection() const { 139 protocol::ConnectionToClient* connection() const {
143 return connection_.get(); 140 return connection_.get();
144 } 141 }
145 142
146 bool is_authenticated() { return is_authenticated_; } 143 bool is_authenticated() { return is_authenticated_; }
147 144
148 const std::string* client_capabilities() const { 145 const std::string* client_capabilities() const {
149 return client_capabilities_.get(); 146 return client_capabilities_.get();
150 } 147 }
151 148
152 private: 149 private:
153 // Creates a proxy for sending clipboard events to the client. 150 // Creates a proxy for sending clipboard events to the client.
154 scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy(); 151 scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy();
155 152
153 void OnScreenSizeChanged(const webrtc::DesktopSize& size);
154
156 EventHandler* event_handler_; 155 EventHandler* event_handler_;
157 156
158 // The connection to the client. 157 // The connection to the client.
159 scoped_ptr<protocol::ConnectionToClient> connection_; 158 scoped_ptr<protocol::ConnectionToClient> connection_;
160 159
161 std::string client_jid_; 160 std::string client_jid_;
162 161
163 // Used to create a DesktopEnvironment instance for this session. 162 // Used to create a DesktopEnvironment instance for this session.
164 DesktopEnvironmentFactory* desktop_environment_factory_; 163 DesktopEnvironmentFactory* desktop_environment_factory_;
165 164
166 // The DesktopEnvironment instance for this session. 165 // The DesktopEnvironment instance for this session.
167 scoped_ptr<DesktopEnvironment> desktop_environment_; 166 scoped_ptr<DesktopEnvironment> desktop_environment_;
168 167
169 // Filter used as the final element in the input pipeline. 168 // Filter used as the final element in the input pipeline.
170 protocol::InputFilter host_input_filter_; 169 protocol::InputFilter host_input_filter_;
171 170
172 // Tracker used to release pressed keys and buttons when disconnecting. 171 // Tracker used to release pressed keys and buttons when disconnecting.
173 protocol::InputEventTracker input_tracker_; 172 protocol::InputEventTracker input_tracker_;
174 173
175 // Filter used to disable remote inputs during local input activity. 174 // Filter used to disable remote inputs during local input activity.
176 RemoteInputFilter remote_input_filter_; 175 RemoteInputFilter remote_input_filter_;
177 176
178 // Filter used to clamp mouse events to the current display dimensions. 177 // Filter used to clamp mouse events to the current display dimensions.
179 MouseClampingFilter mouse_clamping_filter_; 178 protocol::MouseInputFilter mouse_clamping_filter_;
180 179
181 // Filter to used to stop clipboard items sent from the client being echoed 180 // Filter to used to stop clipboard items sent from the client being echoed
182 // back to it. It is the final element in the clipboard (client -> host) 181 // back to it. It is the final element in the clipboard (client -> host)
183 // pipeline. 182 // pipeline.
184 protocol::ClipboardEchoFilter clipboard_echo_filter_; 183 protocol::ClipboardEchoFilter clipboard_echo_filter_;
185 184
186 // Filters used to manage enabling & disabling of input & clipboard. 185 // Filters used to manage enabling & disabling of input & clipboard.
187 protocol::InputFilter disable_input_filter_; 186 protocol::InputFilter disable_input_filter_;
188 protocol::ClipboardFilter disable_clipboard_filter_; 187 protocol::ClipboardFilter disable_clipboard_filter_;
189 188
(...skipping 10 matching lines...) Expand all
200 // is reached. 199 // is reached.
201 base::OneShotTimer max_duration_timer_; 200 base::OneShotTimer max_duration_timer_;
202 201
203 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; 202 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
204 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_; 203 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner_;
205 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner_; 204 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner_;
206 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_; 205 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner_;
207 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; 206 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_;
208 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; 207 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
209 208
210 // Pumps for audio, video and mouse shape. 209 // Objects responsible for sending video, audio and mouse shape.
211 // |video_frame_pump_| and |mouse_shape_pump_| may be nullptr if the video 210 // |video_stream_| and |mouse_shape_pump_| may be nullptr if the video
212 // stream is handled by an extension, see ResetVideoPipeline(). 211 // stream is handled by an extension, see ResetVideoPipeline().
213 scoped_ptr<AudioPump> audio_pump_; 212 scoped_ptr<AudioPump> audio_pump_;
214 scoped_ptr<protocol::VideoFramePump> video_frame_pump_; 213 scoped_ptr<protocol::VideoStream> video_stream_;
215 scoped_ptr<MouseShapePump> mouse_shape_pump_; 214 scoped_ptr<MouseShapePump> mouse_shape_pump_;
216 215
217 // The set of all capabilities supported by the client. 216 // The set of all capabilities supported by the client.
218 scoped_ptr<std::string> client_capabilities_; 217 scoped_ptr<std::string> client_capabilities_;
219 218
220 // The set of all capabilities supported by the host. 219 // The set of all capabilities supported by the host.
221 std::string host_capabilities_; 220 std::string host_capabilities_;
222 221
223 // The set of all capabilities negotiated between client and host. 222 // The set of all capabilities negotiated between client and host.
224 std::string capabilities_; 223 std::string capabilities_;
(...skipping 24 matching lines...) Expand all
249 // Used to disable callbacks to |this| once DisconnectSession() has been 248 // Used to disable callbacks to |this| once DisconnectSession() has been
250 // called. 249 // called.
251 base::WeakPtrFactory<ClientSessionControl> weak_factory_; 250 base::WeakPtrFactory<ClientSessionControl> weak_factory_;
252 251
253 DISALLOW_COPY_AND_ASSIGN(ClientSession); 252 DISALLOW_COPY_AND_ASSIGN(ClientSession);
254 }; 253 };
255 254
256 } // namespace remoting 255 } // namespace remoting
257 256
258 #endif // REMOTING_HOST_CLIENT_SESSION_H_ 257 #endif // REMOTING_HOST_CLIENT_SESSION_H_
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host_unittest.cc ('k') | remoting/host/client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698