| 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/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "remoting/base/capabilities.h" | 10 #include "remoting/base/capabilities.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 webrtc::DesktopSize(resolution.dips_width(), resolution.dips_height()), | 129 webrtc::DesktopSize(resolution.dips_width(), resolution.dips_height()), |
| 130 webrtc::DesktopVector(kDefaultDPI, kDefaultDPI)); | 130 webrtc::DesktopVector(kDefaultDPI, kDefaultDPI)); |
| 131 | 131 |
| 132 // Try to match the client's resolution. | 132 // Try to match the client's resolution. |
| 133 screen_controls_->SetScreenResolution(client_resolution); | 133 screen_controls_->SetScreenResolution(client_resolution); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { | 136 void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { |
| 137 DCHECK(CalledOnValidThread()); | 137 DCHECK(CalledOnValidThread()); |
| 138 | 138 |
| 139 // Note that |video_scheduler_| may be NULL, depending upon whether extensions | 139 // Note that |video_scheduler_| may be null, depending upon whether extensions |
| 140 // choose to wrap or "steal" the video capturer or encoder. | 140 // choose to wrap or "steal" the video capturer or encoder. |
| 141 if (video_control.has_enable()) { | 141 if (video_control.has_enable()) { |
| 142 VLOG(1) << "Received VideoControl (enable=" | 142 VLOG(1) << "Received VideoControl (enable=" |
| 143 << video_control.enable() << ")"; | 143 << video_control.enable() << ")"; |
| 144 pause_video_ = !video_control.enable(); | 144 pause_video_ = !video_control.enable(); |
| 145 if (video_scheduler_.get()) | 145 if (video_scheduler_.get()) |
| 146 video_scheduler_->Pause(pause_video_); | 146 video_scheduler_->Pause(pause_video_); |
| 147 } | 147 } |
| 148 if (video_control.has_lossless_encode()) { | 148 if (video_control.has_lossless_encode()) { |
| 149 VLOG(1) << "Received VideoControl (lossless_encode=" | 149 VLOG(1) << "Received VideoControl (lossless_encode=" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 disable_input_filter_.set_enabled(false); | 359 disable_input_filter_.set_enabled(false); |
| 360 disable_clipboard_filter_.set_enabled(false); | 360 disable_clipboard_filter_.set_enabled(false); |
| 361 | 361 |
| 362 // Ensure that any pressed keys or buttons are released. | 362 // Ensure that any pressed keys or buttons are released. |
| 363 input_tracker_.ReleaseAll(); | 363 input_tracker_.ReleaseAll(); |
| 364 | 364 |
| 365 // Stop components access the client, audio or video stubs, which are no | 365 // Stop components access the client, audio or video stubs, which are no |
| 366 // longer valid once ConnectionToClient calls OnConnectionClosed(). | 366 // longer valid once ConnectionToClient calls OnConnectionClosed(). |
| 367 if (audio_scheduler_.get()) { | 367 if (audio_scheduler_.get()) { |
| 368 audio_scheduler_->Stop(); | 368 audio_scheduler_->Stop(); |
| 369 audio_scheduler_ = NULL; | 369 audio_scheduler_ = nullptr; |
| 370 } | 370 } |
| 371 if (video_scheduler_.get()) { | 371 if (video_scheduler_.get()) { |
| 372 video_scheduler_->Stop(); | 372 video_scheduler_->Stop(); |
| 373 video_scheduler_ = NULL; | 373 video_scheduler_ = nullptr; |
| 374 } | 374 } |
| 375 | 375 |
| 376 client_clipboard_factory_.InvalidateWeakPtrs(); | 376 client_clipboard_factory_.InvalidateWeakPtrs(); |
| 377 input_injector_.reset(); | 377 input_injector_.reset(); |
| 378 screen_controls_.reset(); | 378 screen_controls_.reset(); |
| 379 desktop_environment_.reset(); | 379 desktop_environment_.reset(); |
| 380 | 380 |
| 381 // Notify the ChromotingHost that this client is disconnected. | 381 // Notify the ChromotingHost that this client is disconnected. |
| 382 // TODO(sergeyu): Log failure reason? | 382 // TODO(sergeyu): Log failure reason? |
| 383 event_handler_->OnSessionClosed(this); | 383 event_handler_->OnSessionClosed(this); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 429 |
| 430 disable_input_filter_.set_enabled(!disable_inputs); | 430 disable_input_filter_.set_enabled(!disable_inputs); |
| 431 disable_clipboard_filter_.set_enabled(!disable_inputs); | 431 disable_clipboard_filter_.set_enabled(!disable_inputs); |
| 432 } | 432 } |
| 433 | 433 |
| 434 void ClientSession::ResetVideoPipeline() { | 434 void ClientSession::ResetVideoPipeline() { |
| 435 DCHECK(CalledOnValidThread()); | 435 DCHECK(CalledOnValidThread()); |
| 436 | 436 |
| 437 if (video_scheduler_.get()) { | 437 if (video_scheduler_.get()) { |
| 438 video_scheduler_->Stop(); | 438 video_scheduler_->Stop(); |
| 439 video_scheduler_ = NULL; | 439 video_scheduler_ = nullptr; |
| 440 } | 440 } |
| 441 | 441 |
| 442 // Create VideoEncoder and DesktopCapturer to match the session's video | 442 // Create VideoEncoder and DesktopCapturer to match the session's video |
| 443 // channel configuration. | 443 // channel configuration. |
| 444 scoped_ptr<webrtc::DesktopCapturer> video_capturer = | 444 scoped_ptr<webrtc::DesktopCapturer> video_capturer = |
| 445 desktop_environment_->CreateVideoCapturer(); | 445 desktop_environment_->CreateVideoCapturer(); |
| 446 extension_manager_->OnCreateVideoCapturer(&video_capturer); | 446 extension_manager_->OnCreateVideoCapturer(&video_capturer); |
| 447 scoped_ptr<VideoEncoder> video_encoder = | 447 scoped_ptr<VideoEncoder> video_encoder = |
| 448 CreateVideoEncoder(connection_->session()->config()); | 448 CreateVideoEncoder(connection_->session()->config()); |
| 449 extension_manager_->OnCreateVideoEncoder(&video_encoder); | 449 extension_manager_->OnCreateVideoEncoder(&video_encoder); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 return make_scoped_ptr(new AudioEncoderVerbatim()); | 513 return make_scoped_ptr(new AudioEncoderVerbatim()); |
| 514 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { | 514 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { |
| 515 return make_scoped_ptr(new AudioEncoderOpus()); | 515 return make_scoped_ptr(new AudioEncoderOpus()); |
| 516 } | 516 } |
| 517 | 517 |
| 518 NOTREACHED(); | 518 NOTREACHED(); |
| 519 return nullptr; | 519 return nullptr; |
| 520 } | 520 } |
| 521 | 521 |
| 522 } // namespace remoting | 522 } // namespace remoting |
| OLD | NEW |