| 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 | 9 |
| 9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 10 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "remoting/base/capabilities.h" | 14 #include "remoting/base/capabilities.h" |
| 14 #include "remoting/base/logging.h" | 15 #include "remoting/base/logging.h" |
| 15 #include "remoting/codec/audio_encoder.h" | 16 #include "remoting/codec/audio_encoder.h" |
| 16 #include "remoting/codec/audio_encoder_opus.h" | 17 #include "remoting/codec/audio_encoder_opus.h" |
| 17 #include "remoting/codec/audio_encoder_verbatim.h" | 18 #include "remoting/codec/audio_encoder_verbatim.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 69 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
| 69 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, | 70 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, |
| 70 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 71 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 71 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 72 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 72 scoped_ptr<protocol::ConnectionToClient> connection, | 73 scoped_ptr<protocol::ConnectionToClient> connection, |
| 73 DesktopEnvironmentFactory* desktop_environment_factory, | 74 DesktopEnvironmentFactory* desktop_environment_factory, |
| 74 const base::TimeDelta& max_duration, | 75 const base::TimeDelta& max_duration, |
| 75 scoped_refptr<protocol::PairingRegistry> pairing_registry, | 76 scoped_refptr<protocol::PairingRegistry> pairing_registry, |
| 76 const std::vector<HostExtension*>& extensions) | 77 const std::vector<HostExtension*>& extensions) |
| 77 : event_handler_(event_handler), | 78 : event_handler_(event_handler), |
| 78 connection_(connection.Pass()), | 79 connection_(std::move(connection)), |
| 79 client_jid_(connection_->session()->jid()), | 80 client_jid_(connection_->session()->jid()), |
| 80 desktop_environment_factory_(desktop_environment_factory), | 81 desktop_environment_factory_(desktop_environment_factory), |
| 81 input_tracker_(&host_input_filter_), | 82 input_tracker_(&host_input_filter_), |
| 82 remote_input_filter_(&input_tracker_), | 83 remote_input_filter_(&input_tracker_), |
| 83 mouse_clamping_filter_(&remote_input_filter_), | 84 mouse_clamping_filter_(&remote_input_filter_), |
| 84 disable_input_filter_(&mouse_clamping_filter_), | 85 disable_input_filter_(&mouse_clamping_filter_), |
| 85 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), | 86 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), |
| 86 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), | 87 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), |
| 87 max_duration_(max_duration), | 88 max_duration_(max_duration), |
| 88 audio_task_runner_(audio_task_runner), | 89 audio_task_runner_(audio_task_runner), |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 337 |
| 337 // Start recording video. | 338 // Start recording video. |
| 338 ResetVideoPipeline(); | 339 ResetVideoPipeline(); |
| 339 | 340 |
| 340 // Create an AudioPump if audio is enabled, to pump audio samples. | 341 // Create an AudioPump if audio is enabled, to pump audio samples. |
| 341 if (connection_->session()->config().is_audio_enabled()) { | 342 if (connection_->session()->config().is_audio_enabled()) { |
| 342 scoped_ptr<AudioEncoder> audio_encoder = | 343 scoped_ptr<AudioEncoder> audio_encoder = |
| 343 CreateAudioEncoder(connection_->session()->config()); | 344 CreateAudioEncoder(connection_->session()->config()); |
| 344 audio_pump_.reset(new AudioPump( | 345 audio_pump_.reset(new AudioPump( |
| 345 audio_task_runner_, desktop_environment_->CreateAudioCapturer(), | 346 audio_task_runner_, desktop_environment_->CreateAudioCapturer(), |
| 346 audio_encoder.Pass(), connection_->audio_stub())); | 347 std::move(audio_encoder), connection_->audio_stub())); |
| 347 } | 348 } |
| 348 | 349 |
| 349 // Notify the event handler that all our channels are now connected. | 350 // Notify the event handler that all our channels are now connected. |
| 350 event_handler_->OnSessionChannelsConnected(this); | 351 event_handler_->OnSessionChannelsConnected(this); |
| 351 } | 352 } |
| 352 | 353 |
| 353 void ClientSession::OnConnectionClosed( | 354 void ClientSession::OnConnectionClosed( |
| 354 protocol::ConnectionToClient* connection, | 355 protocol::ConnectionToClient* connection, |
| 355 protocol::ErrorCode error) { | 356 protocol::ErrorCode error) { |
| 356 DCHECK(CalledOnValidThread()); | 357 DCHECK(CalledOnValidThread()); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 mouse_shape_pump_.reset( | 458 mouse_shape_pump_.reset( |
| 458 new MouseShapePump(video_capture_task_runner_, | 459 new MouseShapePump(video_capture_task_runner_, |
| 459 desktop_environment_->CreateMouseCursorMonitor(), | 460 desktop_environment_->CreateMouseCursorMonitor(), |
| 460 connection_->client_stub())); | 461 connection_->client_stub())); |
| 461 | 462 |
| 462 // Create a VideoStream to pump frames from the capturer to the client. | 463 // Create a VideoStream to pump frames from the capturer to the client. |
| 463 | 464 |
| 464 // TODO(sergeyu): Move DesktopCapturerProxy creation to DesktopEnvironment. | 465 // TODO(sergeyu): Move DesktopCapturerProxy creation to DesktopEnvironment. |
| 465 // When using IpcDesktopCapturer the capture thread is not useful. | 466 // When using IpcDesktopCapturer the capture thread is not useful. |
| 466 scoped_ptr<webrtc::DesktopCapturer> capturer_proxy(new DesktopCapturerProxy( | 467 scoped_ptr<webrtc::DesktopCapturer> capturer_proxy(new DesktopCapturerProxy( |
| 467 video_capture_task_runner_, video_capturer.Pass())); | 468 video_capture_task_runner_, std::move(video_capturer))); |
| 468 | 469 |
| 469 video_stream_ = connection_->StartVideoStream(capturer_proxy.Pass()); | 470 video_stream_ = connection_->StartVideoStream(std::move(capturer_proxy)); |
| 470 video_stream_->SetSizeCallback( | 471 video_stream_->SetSizeCallback( |
| 471 base::Bind(&ClientSession::OnScreenSizeChanged, base::Unretained(this))); | 472 base::Bind(&ClientSession::OnScreenSizeChanged, base::Unretained(this))); |
| 472 | 473 |
| 473 // Apply video-control parameters to the new stream. | 474 // Apply video-control parameters to the new stream. |
| 474 video_stream_->SetLosslessEncode(lossless_video_encode_); | 475 video_stream_->SetLosslessEncode(lossless_video_encode_); |
| 475 video_stream_->SetLosslessColor(lossless_video_color_); | 476 video_stream_->SetLosslessColor(lossless_video_color_); |
| 476 | 477 |
| 477 // Pause capturing if necessary. | 478 // Pause capturing if necessary. |
| 478 video_stream_->Pause(pause_video_); | 479 video_stream_->Pause(pause_video_); |
| 479 } | 480 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 492 base::ThreadTaskRunnerHandle::Get())); | 493 base::ThreadTaskRunnerHandle::Get())); |
| 493 } | 494 } |
| 494 | 495 |
| 495 void ClientSession::OnScreenSizeChanged(const webrtc::DesktopSize& size) { | 496 void ClientSession::OnScreenSizeChanged(const webrtc::DesktopSize& size) { |
| 496 DCHECK(CalledOnValidThread()); | 497 DCHECK(CalledOnValidThread()); |
| 497 mouse_clamping_filter_.set_input_size(size); | 498 mouse_clamping_filter_.set_input_size(size); |
| 498 mouse_clamping_filter_.set_output_size(size); | 499 mouse_clamping_filter_.set_output_size(size); |
| 499 } | 500 } |
| 500 | 501 |
| 501 } // namespace remoting | 502 } // namespace remoting |
| OLD | NEW |