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

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

Issue 11781003: Connect to DesktopEnvironment's stubs only when audio/video schedulers are about to be created. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback #2 Created 7 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/client_session.h ('k') | remoting/host/client_session_unittest.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 #include "remoting/host/client_session.h" 5 #include "remoting/host/client_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "remoting/capturer/video_frame_capturer.h" 10 #include "remoting/capturer/video_frame_capturer.h"
(...skipping 23 matching lines...) Expand all
34 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, 34 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner,
35 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, 35 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
36 scoped_ptr<protocol::ConnectionToClient> connection, 36 scoped_ptr<protocol::ConnectionToClient> connection,
37 DesktopEnvironmentFactory* desktop_environment_factory, 37 DesktopEnvironmentFactory* desktop_environment_factory,
38 const base::TimeDelta& max_duration) 38 const base::TimeDelta& max_duration)
39 : event_handler_(event_handler), 39 : event_handler_(event_handler),
40 connection_(connection.Pass()), 40 connection_(connection.Pass()),
41 connection_factory_(connection_.get()), 41 connection_factory_(connection_.get()),
42 desktop_environment_(desktop_environment_factory->Create()), 42 desktop_environment_(desktop_environment_factory->Create()),
43 client_jid_(connection_->session()->jid()), 43 client_jid_(connection_->session()->jid()),
44 host_clipboard_stub_(desktop_environment_->event_executor()), 44 input_tracker_(&host_input_filter_),
45 host_input_stub_(desktop_environment_->event_executor()),
46 input_tracker_(host_input_stub_),
47 remote_input_filter_(&input_tracker_), 45 remote_input_filter_(&input_tracker_),
48 mouse_clamping_filter_(desktop_environment_->video_capturer(), 46 mouse_clamping_filter_(&remote_input_filter_, connection_->video_stub()),
49 &remote_input_filter_), 47 disable_input_filter_(mouse_clamping_filter_.input_filter()),
50 disable_input_filter_(&mouse_clamping_filter_),
51 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), 48 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()),
52 auth_input_filter_(&disable_input_filter_), 49 auth_input_filter_(&disable_input_filter_),
53 auth_clipboard_filter_(&disable_clipboard_filter_), 50 auth_clipboard_filter_(&disable_clipboard_filter_),
54 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), 51 client_clipboard_factory_(clipboard_echo_filter_.client_filter()),
55 max_duration_(max_duration), 52 max_duration_(max_duration),
56 audio_task_runner_(audio_task_runner), 53 audio_task_runner_(audio_task_runner),
57 video_capture_task_runner_(video_capture_task_runner), 54 video_capture_task_runner_(video_capture_task_runner),
58 video_encode_task_runner_(video_encode_task_runner), 55 video_encode_task_runner_(video_encode_task_runner),
59 network_task_runner_(network_task_runner), 56 network_task_runner_(network_task_runner),
60 active_recorders_(0) { 57 active_recorders_(0) {
61 connection_->SetEventHandler(this); 58 connection_->SetEventHandler(this);
62 59
63 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be 60 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be
64 // set before channels are connected. Make it possible to set stubs 61 // set before channels are connected. Make it possible to set stubs
65 // later and set them only when connection is authenticated. 62 // later and set them only when connection is authenticated.
66 connection_->set_clipboard_stub(&auth_clipboard_filter_); 63 connection_->set_clipboard_stub(&auth_clipboard_filter_);
67 connection_->set_host_stub(this); 64 connection_->set_host_stub(this);
68 connection_->set_input_stub(&auth_input_filter_); 65 connection_->set_input_stub(&auth_input_filter_);
69 clipboard_echo_filter_.set_host_stub(host_clipboard_stub_);
70 66
71 // |auth_*_filter_|'s states reflect whether the session is authenticated. 67 // |auth_*_filter_|'s states reflect whether the session is authenticated.
72 auth_input_filter_.set_enabled(false); 68 auth_input_filter_.set_enabled(false);
73 auth_clipboard_filter_.set_enabled(false); 69 auth_clipboard_filter_.set_enabled(false);
74 } 70 }
75 71
76 void ClientSession::NotifyClientDimensions( 72 void ClientSession::NotifyClientDimensions(
77 const protocol::ClientDimensions& dimensions) { 73 const protocol::ClientDimensions& dimensions) {
78 if (dimensions.has_width() && dimensions.has_height()) { 74 if (dimensions.has_width() && dimensions.has_height()) {
79 VLOG(1) << "Received ClientDimensions (width=" 75 VLOG(1) << "Received ClientDimensions (width="
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 this, &ClientSession::Disconnect); 116 this, &ClientSession::Disconnect);
121 } 117 }
122 118
123 event_handler_->OnSessionAuthenticated(this); 119 event_handler_->OnSessionAuthenticated(this);
124 } 120 }
125 121
126 void ClientSession::OnConnectionChannelsConnected( 122 void ClientSession::OnConnectionChannelsConnected(
127 protocol::ConnectionToClient* connection) { 123 protocol::ConnectionToClient* connection) {
128 DCHECK(CalledOnValidThread()); 124 DCHECK(CalledOnValidThread());
129 DCHECK_EQ(connection_.get(), connection); 125 DCHECK_EQ(connection_.get(), connection);
126
127 // Connect the host clipboard and input stubs.
128 host_input_filter_.set_input_stub(desktop_environment_->event_executor());
129 clipboard_echo_filter_.set_host_stub(desktop_environment_->event_executor());
130
130 SetDisableInputs(false); 131 SetDisableInputs(false);
131 132
132 // Let the desktop environment notify us of local clipboard changes. 133 // Let the desktop environment notify us of local clipboard changes.
133 desktop_environment_->Start( 134 desktop_environment_->Start(
134 CreateClipboardProxy(), 135 CreateClipboardProxy(),
135 client_jid(), 136 client_jid(),
136 base::Bind(&protocol::ConnectionToClient::Disconnect, 137 base::Bind(&protocol::ConnectionToClient::Disconnect,
137 connection_factory_.GetWeakPtr())); 138 connection_factory_.GetWeakPtr()));
138 139
139 // Create a VideoEncoder based on the session's video channel configuration. 140 // Create a VideoEncoder based on the session's video channel configuration.
140 scoped_ptr<VideoEncoder> video_encoder = 141 scoped_ptr<VideoEncoder> video_encoder =
141 CreateVideoEncoder(connection_->session()->config()); 142 CreateVideoEncoder(connection_->session()->config());
142 143
143 // Create a VideoScheduler to pump frames from the capturer to the client. 144 // Create a VideoScheduler to pump frames from the capturer to the client.
144 video_scheduler_ = VideoScheduler::Create( 145 video_scheduler_ = VideoScheduler::Create(
145 video_capture_task_runner_, 146 video_capture_task_runner_,
146 video_encode_task_runner_, 147 video_encode_task_runner_,
147 network_task_runner_, 148 network_task_runner_,
148 desktop_environment_->video_capturer(), 149 desktop_environment_->video_capturer(),
149 video_encoder.Pass(), 150 video_encoder.Pass(),
150 connection_->client_stub(), 151 connection_->client_stub(),
151 connection_->video_stub()); 152 &mouse_clamping_filter_);
152 ++active_recorders_; 153 ++active_recorders_;
153 154
154 // Create an AudioScheduler if audio is enabled, to pump audio samples. 155 // Create an AudioScheduler if audio is enabled, to pump audio samples.
155 if (connection_->session()->config().is_audio_enabled()) { 156 if (connection_->session()->config().is_audio_enabled()) {
156 scoped_ptr<AudioEncoder> audio_encoder = 157 scoped_ptr<AudioEncoder> audio_encoder =
157 CreateAudioEncoder(connection_->session()->config()); 158 CreateAudioEncoder(connection_->session()->config());
158 audio_scheduler_ = AudioScheduler::Create( 159 audio_scheduler_ = AudioScheduler::Create(
159 audio_task_runner_, 160 audio_task_runner_,
160 network_task_runner_, 161 network_task_runner_,
161 desktop_environment_->audio_capturer(), 162 desktop_environment_->audio_capturer(),
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 NOTIMPLEMENTED(); 337 NOTIMPLEMENTED();
337 return scoped_ptr<AudioEncoder>(NULL); 338 return scoped_ptr<AudioEncoder>(NULL);
338 } 339 }
339 340
340 // static 341 // static
341 void ClientSessionTraits::Destruct(const ClientSession* client) { 342 void ClientSessionTraits::Destruct(const ClientSession* client) {
342 client->network_task_runner_->DeleteSoon(FROM_HERE, client); 343 client->network_task_runner_->DeleteSoon(FROM_HERE, client);
343 } 344 }
344 345
345 } // namespace remoting 346 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/client_session.h ('k') | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698