| 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" |
| 11 #include "remoting/base/logging.h" | 11 #include "remoting/base/logging.h" |
| 12 #include "remoting/codec/audio_encoder.h" | 12 #include "remoting/codec/audio_encoder.h" |
| 13 #include "remoting/codec/audio_encoder_opus.h" | 13 #include "remoting/codec/audio_encoder_opus.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_vpx.h" | 17 #include "remoting/codec/video_encoder_vpx.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/host_extension_session.h" | 21 #include "remoting/host/host_extension_session.h" |
| 22 #include "remoting/host/input_injector.h" | 22 #include "remoting/host/input_injector.h" |
| 23 #include "remoting/host/screen_controls.h" | 23 #include "remoting/host/screen_controls.h" |
| 24 #include "remoting/host/screen_resolution.h" | 24 #include "remoting/host/screen_resolution.h" |
| 25 #include "remoting/host/video_frame_recorder.h" |
| 25 #include "remoting/host/video_scheduler.h" | 26 #include "remoting/host/video_scheduler.h" |
| 26 #include "remoting/proto/control.pb.h" | 27 #include "remoting/proto/control.pb.h" |
| 27 #include "remoting/proto/event.pb.h" | 28 #include "remoting/proto/event.pb.h" |
| 28 #include "remoting/protocol/client_stub.h" | 29 #include "remoting/protocol/client_stub.h" |
| 29 #include "remoting/protocol/clipboard_thread_proxy.h" | 30 #include "remoting/protocol/clipboard_thread_proxy.h" |
| 30 #include "remoting/protocol/pairing_registry.h" | 31 #include "remoting/protocol/pairing_registry.h" |
| 31 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 32 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
| 32 | 33 |
| 33 // Default DPI to assume for old clients that use notifyClientDimensions. | 34 // Default DPI to assume for old clients that use notifyClientDimensions. |
| 34 const int kDefaultDPI = 96; | 35 const int kDefaultDPI = 96; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 input_injector_ = desktop_environment_->CreateInputInjector(); | 312 input_injector_ = desktop_environment_->CreateInputInjector(); |
| 312 | 313 |
| 313 // Connect the host clipboard and input stubs. | 314 // Connect the host clipboard and input stubs. |
| 314 host_input_filter_.set_input_stub(input_injector_.get()); | 315 host_input_filter_.set_input_stub(input_injector_.get()); |
| 315 clipboard_echo_filter_.set_host_stub(input_injector_.get()); | 316 clipboard_echo_filter_.set_host_stub(input_injector_.get()); |
| 316 | 317 |
| 317 // Create a VideoEncoder based on the session's video channel configuration. | 318 // Create a VideoEncoder based on the session's video channel configuration. |
| 318 scoped_ptr<VideoEncoder> video_encoder = | 319 scoped_ptr<VideoEncoder> video_encoder = |
| 319 CreateVideoEncoder(connection_->session()->config()); | 320 CreateVideoEncoder(connection_->session()->config()); |
| 320 | 321 |
| 322 // If video recording is enabled, wrap the encoder with the recorder. |
| 323 if (video_frame_recorder_) { |
| 324 video_encoder = video_frame_recorder_->WrapVideoEncoder( |
| 325 video_encoder.Pass()); |
| 326 } |
| 327 |
| 321 // Create a VideoScheduler to pump frames from the capturer to the client. | 328 // Create a VideoScheduler to pump frames from the capturer to the client. |
| 322 video_scheduler_ = new VideoScheduler( | 329 video_scheduler_ = new VideoScheduler( |
| 323 video_capture_task_runner_, | 330 video_capture_task_runner_, |
| 324 video_encode_task_runner_, | 331 video_encode_task_runner_, |
| 325 network_task_runner_, | 332 network_task_runner_, |
| 326 desktop_environment_->CreateVideoCapturer(), | 333 desktop_environment_->CreateVideoCapturer(), |
| 327 video_encoder.Pass(), | 334 video_encoder.Pass(), |
| 328 connection_->client_stub(), | 335 connection_->client_stub(), |
| 329 &mouse_clamping_filter_); | 336 &mouse_clamping_filter_); |
| 330 | 337 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 469 |
| 463 if (disable_inputs) | 470 if (disable_inputs) |
| 464 input_tracker_.ReleaseAll(); | 471 input_tracker_.ReleaseAll(); |
| 465 | 472 |
| 466 disable_input_filter_.set_enabled(!disable_inputs); | 473 disable_input_filter_.set_enabled(!disable_inputs); |
| 467 disable_clipboard_filter_.set_enabled(!disable_inputs); | 474 disable_clipboard_filter_.set_enabled(!disable_inputs); |
| 468 } | 475 } |
| 469 | 476 |
| 470 void ClientSession::SetGnubbyAuthHandlerForTesting( | 477 void ClientSession::SetGnubbyAuthHandlerForTesting( |
| 471 GnubbyAuthHandler* gnubby_auth_handler) { | 478 GnubbyAuthHandler* gnubby_auth_handler) { |
| 479 DCHECK(CalledOnValidThread()); |
| 472 gnubby_auth_handler_.reset(gnubby_auth_handler); | 480 gnubby_auth_handler_.reset(gnubby_auth_handler); |
| 473 } | 481 } |
| 474 | 482 |
| 483 void ClientSession::set_video_frame_recorder( |
| 484 scoped_ptr<VideoFrameRecorder> recorder) { |
| 485 DCHECK(CalledOnValidThread()); |
| 486 video_frame_recorder_ = recorder.Pass(); |
| 487 } |
| 488 |
| 489 VideoFrameRecorder* ClientSession::video_frame_recorder() const { |
| 490 return video_frame_recorder_.get(); |
| 491 } |
| 492 |
| 475 scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { | 493 scoped_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { |
| 476 DCHECK(CalledOnValidThread()); | 494 DCHECK(CalledOnValidThread()); |
| 477 | 495 |
| 478 return scoped_ptr<protocol::ClipboardStub>( | 496 return scoped_ptr<protocol::ClipboardStub>( |
| 479 new protocol::ClipboardThreadProxy( | 497 new protocol::ClipboardThreadProxy( |
| 480 client_clipboard_factory_.GetWeakPtr(), | 498 client_clipboard_factory_.GetWeakPtr(), |
| 481 base::MessageLoopProxy::current())); | 499 base::MessageLoopProxy::current())); |
| 482 } | 500 } |
| 483 | 501 |
| 484 // TODO(sergeyu): Move this to SessionManager? | 502 // TODO(sergeyu): Move this to SessionManager? |
| (...skipping 21 matching lines...) Expand all Loading... |
| 506 return scoped_ptr<AudioEncoder>(new AudioEncoderVerbatim()); | 524 return scoped_ptr<AudioEncoder>(new AudioEncoderVerbatim()); |
| 507 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { | 525 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { |
| 508 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); | 526 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); |
| 509 } | 527 } |
| 510 | 528 |
| 511 NOTREACHED(); | 529 NOTREACHED(); |
| 512 return scoped_ptr<AudioEncoder>(); | 530 return scoped_ptr<AudioEncoder>(); |
| 513 } | 531 } |
| 514 | 532 |
| 515 } // namespace remoting | 533 } // namespace remoting |
| OLD | NEW |