| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "remoting/base/auto_thread_task_runner.h" |
| 15 #include "remoting/base/capabilities.h" | 16 #include "remoting/base/capabilities.h" |
| 16 #include "remoting/base/constants.h" | 17 #include "remoting/base/constants.h" |
| 17 #include "remoting/base/logging.h" | 18 #include "remoting/base/logging.h" |
| 18 #include "remoting/codec/audio_encoder.h" | 19 #include "remoting/codec/audio_encoder.h" |
| 19 #include "remoting/codec/audio_encoder_opus.h" | 20 #include "remoting/codec/audio_encoder_opus.h" |
| 20 #include "remoting/codec/audio_encoder_verbatim.h" | 21 #include "remoting/codec/audio_encoder_verbatim.h" |
| 21 #include "remoting/host/audio_capturer.h" | 22 #include "remoting/host/audio_capturer.h" |
| 22 #include "remoting/host/audio_pump.h" | 23 #include "remoting/host/audio_pump.h" |
| 23 #include "remoting/host/desktop_environment.h" | 24 #include "remoting/host/desktop_environment.h" |
| 24 #include "remoting/host/host_extension_session.h" | 25 #include "remoting/host/host_extension_session.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 53 return base::WrapUnique(new AudioEncoderOpus()); | 54 return base::WrapUnique(new AudioEncoderOpus()); |
| 54 } | 55 } |
| 55 | 56 |
| 56 NOTREACHED(); | 57 NOTREACHED(); |
| 57 return nullptr; | 58 return nullptr; |
| 58 } | 59 } |
| 59 | 60 |
| 60 } // namespace | 61 } // namespace |
| 61 | 62 |
| 62 ClientSession::ClientSession( | 63 ClientSession::ClientSession( |
| 64 const ChromotingHostContext& context, |
| 63 EventHandler* event_handler, | 65 EventHandler* event_handler, |
| 64 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, | |
| 65 std::unique_ptr<protocol::ConnectionToClient> connection, | 66 std::unique_ptr<protocol::ConnectionToClient> connection, |
| 66 DesktopEnvironmentFactory* desktop_environment_factory, | 67 DesktopEnvironmentFactory* desktop_environment_factory, |
| 67 const base::TimeDelta& max_duration, | 68 const base::TimeDelta& max_duration, |
| 68 scoped_refptr<protocol::PairingRegistry> pairing_registry, | 69 scoped_refptr<protocol::PairingRegistry> pairing_registry, |
| 69 const std::vector<HostExtension*>& extensions) | 70 const std::vector<HostExtension*>& extensions) |
| 70 : event_handler_(event_handler), | 71 : event_handler_(event_handler), |
| 71 connection_(std::move(connection)), | 72 connection_(std::move(connection)), |
| 72 client_jid_(connection_->session()->jid()), | 73 client_jid_(connection_->session()->jid()), |
| 73 desktop_environment_factory_(desktop_environment_factory), | 74 desktop_environment_factory_(desktop_environment_factory), |
| 74 input_tracker_(&host_input_filter_), | 75 input_tracker_(&host_input_filter_), |
| 75 remote_input_filter_(&input_tracker_), | 76 remote_input_filter_(&input_tracker_), |
| 76 mouse_clamping_filter_(&remote_input_filter_), | 77 mouse_clamping_filter_(&remote_input_filter_), |
| 77 disable_input_filter_(&mouse_clamping_filter_), | 78 disable_input_filter_(&mouse_clamping_filter_), |
| 78 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), | 79 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), |
| 79 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), | 80 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), |
| 80 max_duration_(max_duration), | 81 max_duration_(max_duration), |
| 81 audio_task_runner_(audio_task_runner), | 82 audio_task_runner_(context.audio_task_runner()), |
| 82 pairing_registry_(pairing_registry), | 83 pairing_registry_(pairing_registry), |
| 83 // Note that |lossless_video_color_| defaults to true, but actually only | 84 // Note that |lossless_video_color_| defaults to true, but actually only |
| 84 // controls VP9 video stream color quality. | 85 // controls VP9 video stream color quality. |
| 85 lossless_video_color_(!base::CommandLine::ForCurrentProcess()->HasSwitch( | 86 lossless_video_color_(!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 86 kDisableI444SwitchName)), | 87 kDisableI444SwitchName)), |
| 88 power_save_blocker_( |
| 89 device::PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
| 90 device::PowerSaveBlocker::kReasonVideoPlayback, |
| 91 "Remoting session is active", |
| 92 context.ui_task_runner(), |
| 93 context.file_task_runner()), |
| 87 weak_factory_(this) { | 94 weak_factory_(this) { |
| 88 connection_->SetEventHandler(this); | 95 connection_->SetEventHandler(this); |
| 89 | 96 |
| 90 // Create a manager for the configured extensions, if any. | 97 // Create a manager for the configured extensions, if any. |
| 91 extension_manager_.reset(new HostExtensionSessionManager(extensions, this)); | 98 extension_manager_.reset(new HostExtensionSessionManager(extensions, this)); |
| 92 | 99 |
| 93 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
| 94 // LocalInputMonitorWin filters out an echo of the injected input before it | 101 // LocalInputMonitorWin filters out an echo of the injected input before it |
| 95 // reaches |remote_input_filter_|. | 102 // reaches |remote_input_filter_|. |
| 96 remote_input_filter_.SetExpectLocalEcho(false); | 103 remote_input_filter_.SetExpectLocalEcho(false); |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 } | 483 } |
| 477 } | 484 } |
| 478 | 485 |
| 479 void ClientSession::OnVideoFrameSent(protocol::VideoStream* stream, | 486 void ClientSession::OnVideoFrameSent(protocol::VideoStream* stream, |
| 480 uint32_t frame_id, | 487 uint32_t frame_id, |
| 481 int64_t input_event_timestamp) { | 488 int64_t input_event_timestamp) { |
| 482 // TODO(sergeyu): Send a message to the client to notify about the new frame. | 489 // TODO(sergeyu): Send a message to the client to notify about the new frame. |
| 483 } | 490 } |
| 484 | 491 |
| 485 } // namespace remoting | 492 } // namespace remoting |
| OLD | NEW |