Chromium Code Reviews| 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 "media/video/capture/screen/screen_capturer.h" | 10 #include "media/video/capture/screen/screen_capturer.h" |
| 11 #include "remoting/codec/audio_encoder.h" | 11 #include "remoting/codec/audio_encoder.h" |
| 12 #include "remoting/codec/audio_encoder_opus.h" | 12 #include "remoting/codec/audio_encoder_opus.h" |
| 13 #include "remoting/codec/audio_encoder_speex.h" | 13 #include "remoting/codec/audio_encoder_speex.h" |
| 14 #include "remoting/codec/audio_encoder_verbatim.h" | 14 #include "remoting/codec/audio_encoder_verbatim.h" |
| 15 #include "remoting/codec/video_encoder.h" | 15 #include "remoting/codec/video_encoder.h" |
| 16 #include "remoting/codec/video_encoder_verbatim.h" | 16 #include "remoting/codec/video_encoder_verbatim.h" |
| 17 #include "remoting/codec/video_encoder_vp8.h" | 17 #include "remoting/codec/video_encoder_vp8.h" |
| 18 #include "remoting/host/audio_capturer.h" | 18 #include "remoting/host/audio_capturer.h" |
| 19 #include "remoting/host/audio_scheduler.h" | 19 #include "remoting/host/audio_scheduler.h" |
| 20 #include "remoting/host/desktop_environment.h" | 20 #include "remoting/host/desktop_environment.h" |
| 21 #include "remoting/host/event_executor.h" | 21 #include "remoting/host/event_executor.h" |
| 22 #include "remoting/host/video_scheduler.h" | 22 #include "remoting/host/video_scheduler.h" |
| 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 namespace { | |
| 31 // Default DPI to assume for old clients that use notifyClientDimensions. | |
| 32 const int kDefaultDPI = 96; | |
| 33 } // namespace | |
| 34 | |
| 30 ClientSession::ClientSession( | 35 ClientSession::ClientSession( |
| 31 EventHandler* event_handler, | 36 EventHandler* event_handler, |
| 32 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, | 37 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, |
| 33 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 38 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 34 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 39 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
| 35 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, | 40 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, |
| 36 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 41 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 37 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 42 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 38 scoped_ptr<protocol::ConnectionToClient> connection, | 43 scoped_ptr<protocol::ConnectionToClient> connection, |
| 39 DesktopEnvironmentFactory* desktop_environment_factory, | 44 DesktopEnvironmentFactory* desktop_environment_factory, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 68 // later and set them only when connection is authenticated. | 73 // later and set them only when connection is authenticated. |
| 69 connection_->set_clipboard_stub(&auth_clipboard_filter_); | 74 connection_->set_clipboard_stub(&auth_clipboard_filter_); |
| 70 connection_->set_host_stub(this); | 75 connection_->set_host_stub(this); |
| 71 connection_->set_input_stub(&auth_input_filter_); | 76 connection_->set_input_stub(&auth_input_filter_); |
| 72 | 77 |
| 73 // |auth_*_filter_|'s states reflect whether the session is authenticated. | 78 // |auth_*_filter_|'s states reflect whether the session is authenticated. |
| 74 auth_input_filter_.set_enabled(false); | 79 auth_input_filter_.set_enabled(false); |
| 75 auth_clipboard_filter_.set_enabled(false); | 80 auth_clipboard_filter_.set_enabled(false); |
| 76 } | 81 } |
| 77 | 82 |
| 78 void ClientSession::NotifyClientDimensions( | 83 void ClientSession::NotifyClientResolution( |
| 79 const protocol::ClientDimensions& dimensions) { | 84 const protocol::ClientResolution& resolution) { |
| 80 if (dimensions.has_width() && dimensions.has_height()) { | 85 if (resolution.has_dips_width() && resolution.has_dips_height()) { |
| 81 VLOG(1) << "Received ClientDimensions (width=" | 86 VLOG(1) << "Received ClientResolution (dips_width=" |
| 82 << dimensions.width() << ", height=" << dimensions.height() << ")"; | 87 << resolution.width() << ", dips_height=" |
| 83 event_handler_->OnClientDimensionsChanged( | 88 << resolution.height() << ")"; |
| 84 this, SkISize::Make(dimensions.width(), dimensions.height())); | 89 event_handler_->OnClientResolutionChanged( |
| 90 this, | |
| 91 SkISize::Make(resolution.dips_width(), resolution.dips_height()), | |
| 92 SkIPoint::Make(kDefaultDPI, kDefaultDPI)); | |
|
Jamie
2013/02/11 23:25:58
Why not use the new fields, if present? Is that co
Wez
2013/02/12 01:55:28
Adding that separately, in crrev.com/12225113.
| |
| 85 } | 93 } |
| 86 } | 94 } |
| 87 | 95 |
| 88 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { | 96 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { |
| 89 if (video_control.has_enable()) { | 97 if (video_control.has_enable()) { |
| 90 VLOG(1) << "Received VideoControl (enable=" | 98 VLOG(1) << "Received VideoControl (enable=" |
| 91 << video_control.enable() << ")"; | 99 << video_control.enable() << ")"; |
| 92 if (video_scheduler_) | 100 if (video_scheduler_) |
| 93 video_scheduler_->Pause(!video_control.enable()); | 101 video_scheduler_->Pause(!video_control.enable()); |
| 94 } | 102 } |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 NOTIMPLEMENTED(); | 326 NOTIMPLEMENTED(); |
| 319 return scoped_ptr<AudioEncoder>(NULL); | 327 return scoped_ptr<AudioEncoder>(NULL); |
| 320 } | 328 } |
| 321 | 329 |
| 322 // static | 330 // static |
| 323 void ClientSessionTraits::Destruct(const ClientSession* client) { | 331 void ClientSessionTraits::Destruct(const ClientSession* client) { |
| 324 client->network_task_runner_->DeleteSoon(FROM_HERE, client); | 332 client->network_task_runner_->DeleteSoon(FROM_HERE, client); |
| 325 } | 333 } |
| 326 | 334 |
| 327 } // namespace remoting | 335 } // namespace remoting |
| OLD | NEW |