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