| 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 #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/codec/audio_encoder.h" | 10 #include "remoting/codec/audio_encoder.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "remoting/proto/control.pb.h" | 23 #include "remoting/proto/control.pb.h" |
| 24 #include "remoting/proto/event.pb.h" | 24 #include "remoting/proto/event.pb.h" |
| 25 #include "remoting/protocol/client_stub.h" | 25 #include "remoting/protocol/client_stub.h" |
| 26 #include "remoting/protocol/clipboard_thread_proxy.h" | 26 #include "remoting/protocol/clipboard_thread_proxy.h" |
| 27 | 27 |
| 28 namespace remoting { | 28 namespace remoting { |
| 29 | 29 |
| 30 ClientSession::ClientSession( | 30 ClientSession::ClientSession( |
| 31 EventHandler* event_handler, | 31 EventHandler* event_handler, |
| 32 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, | 32 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, |
| 33 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, | 33 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
| 34 scoped_refptr<base::SingleThreadTaskRunner> 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 desktop_environment_(desktop_environment_factory->Create( | 41 desktop_environment_(desktop_environment_factory->Create( |
| 42 ALLOW_THIS_IN_INITIALIZER_LIST(this))), | 42 ALLOW_THIS_IN_INITIALIZER_LIST(this))), |
| 43 client_jid_(connection_->session()->jid()), | 43 client_jid_(connection_->session()->jid()), |
| 44 host_clipboard_stub_(desktop_environment_->event_executor()), | 44 host_clipboard_stub_(desktop_environment_->event_executor()), |
| 45 host_input_stub_(desktop_environment_->event_executor()), | 45 host_input_stub_(desktop_environment_->event_executor()), |
| 46 input_tracker_(host_input_stub_), | 46 input_tracker_(host_input_stub_), |
| 47 remote_input_filter_(&input_tracker_), | 47 remote_input_filter_(&input_tracker_), |
| 48 mouse_clamping_filter_(desktop_environment_->video_capturer(), | 48 mouse_clamping_filter_(desktop_environment_->video_capturer(), |
| 49 &remote_input_filter_), | 49 &remote_input_filter_), |
| 50 disable_input_filter_(&mouse_clamping_filter_), | 50 disable_input_filter_(&mouse_clamping_filter_), |
| 51 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), | 51 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), |
| 52 auth_input_filter_(&disable_input_filter_), | 52 auth_input_filter_(&disable_input_filter_), |
| 53 auth_clipboard_filter_(&disable_clipboard_filter_), | 53 auth_clipboard_filter_(&disable_clipboard_filter_), |
| 54 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), | 54 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), |
| 55 max_duration_(max_duration), | 55 max_duration_(max_duration), |
| 56 audio_task_runner_(audio_task_runner), | 56 audio_task_runner_(audio_task_runner), |
| 57 capture_task_runner_(capture_task_runner), | 57 video_capture_task_runner_(video_capture_task_runner), |
| 58 encode_task_runner_(encode_task_runner), | 58 video_encode_task_runner_(video_encode_task_runner), |
| 59 network_task_runner_(network_task_runner), | 59 network_task_runner_(network_task_runner), |
| 60 active_recorders_(0) { | 60 active_recorders_(0) { |
| 61 connection_->SetEventHandler(this); | 61 connection_->SetEventHandler(this); |
| 62 | 62 |
| 63 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be | 63 // TODO(sergeyu): Currently ConnectionToClient expects stubs to be |
| 64 // set before channels are connected. Make it possible to set stubs | 64 // set before channels are connected. Make it possible to set stubs |
| 65 // later and set them only when connection is authenticated. | 65 // later and set them only when connection is authenticated. |
| 66 connection_->set_clipboard_stub(&auth_clipboard_filter_); | 66 connection_->set_clipboard_stub(&auth_clipboard_filter_); |
| 67 connection_->set_host_stub(this); | 67 connection_->set_host_stub(this); |
| 68 connection_->set_input_stub(&auth_input_filter_); | 68 connection_->set_input_stub(&auth_input_filter_); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 protocol::ConnectionToClient* connection) { | 127 protocol::ConnectionToClient* connection) { |
| 128 DCHECK(CalledOnValidThread()); | 128 DCHECK(CalledOnValidThread()); |
| 129 DCHECK_EQ(connection_.get(), connection); | 129 DCHECK_EQ(connection_.get(), connection); |
| 130 SetDisableInputs(false); | 130 SetDisableInputs(false); |
| 131 | 131 |
| 132 // Create a VideoEncoder based on the session's video channel configuration. | 132 // Create a VideoEncoder based on the session's video channel configuration. |
| 133 scoped_ptr<VideoEncoder> video_encoder = | 133 scoped_ptr<VideoEncoder> video_encoder = |
| 134 CreateVideoEncoder(connection_->session()->config()); | 134 CreateVideoEncoder(connection_->session()->config()); |
| 135 | 135 |
| 136 // Create a VideoScheduler to pump frames from the capturer to the client. | 136 // Create a VideoScheduler to pump frames from the capturer to the client. |
| 137 video_scheduler_ = new VideoScheduler(capture_task_runner_, | 137 video_scheduler_ = new VideoScheduler(video_capture_task_runner_, |
| 138 encode_task_runner_, | 138 video_encode_task_runner_, |
| 139 network_task_runner_, | 139 network_task_runner_, |
| 140 desktop_environment_->video_capturer(), | 140 desktop_environment_->video_capturer(), |
| 141 video_encoder.Pass(), | 141 video_encoder.Pass(), |
| 142 connection_->client_stub(), | 142 connection_->client_stub(), |
| 143 connection_->video_stub()); | 143 connection_->video_stub()); |
| 144 ++active_recorders_; | 144 ++active_recorders_; |
| 145 | 145 |
| 146 // Create an AudioScheduler if audio is enabled, to pump audio samples. | 146 // Create an AudioScheduler if audio is enabled, to pump audio samples. |
| 147 if (connection_->session()->config().is_audio_enabled()) { | 147 if (connection_->session()->config().is_audio_enabled()) { |
| 148 scoped_ptr<AudioEncoder> audio_encoder = | 148 scoped_ptr<AudioEncoder> audio_encoder = |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 NOTIMPLEMENTED(); | 316 NOTIMPLEMENTED(); |
| 317 return scoped_ptr<AudioEncoder>(NULL); | 317 return scoped_ptr<AudioEncoder>(NULL); |
| 318 } | 318 } |
| 319 | 319 |
| 320 // static | 320 // static |
| 321 void ClientSessionTraits::Destruct(const ClientSession* client) { | 321 void ClientSessionTraits::Destruct(const ClientSession* client) { |
| 322 client->network_task_runner_->DeleteSoon(FROM_HERE, client); | 322 client->network_task_runner_->DeleteSoon(FROM_HERE, client); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace remoting | 325 } // namespace remoting |
| OLD | NEW |