Index: remoting/host/client_session.cc |
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc |
index 55e4decc1ca3bb70e29df4836cd787e0f1fbed1c..3a15e0022be54108ec5c1c441bd6ae60ca83a4ee 100644 |
--- a/remoting/host/client_session.cc |
+++ b/remoting/host/client_session.cc |
@@ -67,7 +67,8 @@ ClientSession::ClientSession( |
video_encode_task_runner_(video_encode_task_runner), |
network_task_runner_(network_task_runner), |
ui_task_runner_(ui_task_runner), |
- pairing_registry_(pairing_registry) { |
+ pairing_registry_(pairing_registry), |
+ enable_cast_(false) { |
connection_->SetEventHandler(this); |
// TODO(sergeyu): Currently ConnectionToClient expects stubs to be |
@@ -148,6 +149,11 @@ void ClientSession::NotifyClientResolution( |
void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { |
DCHECK(CalledOnValidThread()); |
+ // If cast is enabled, do nothing. |
+ if (enable_cast_) { |
+ return; |
+ } |
+ |
if (video_control.has_enable()) { |
VLOG(1) << "Received VideoControl (enable=" |
<< video_control.enable() << ")"; |
@@ -310,6 +316,11 @@ void ClientSession::OnConnectionAuthenticated( |
// Create the event executor. |
input_injector_ = desktop_environment_->CreateInputInjector(); |
+ // Create the screen capturer. |
+ // TODO(aiguha): Implement dynamic sharing of the screen capturer between |
+ // VideoScheduler and the CastExtension/CastVideoCapturer. |
+ screen_capturer_ = desktop_environment_->CreateVideoCapturer(); |
+ |
// Connect the host clipboard and input stubs. |
host_input_filter_.set_input_stub(input_injector_.get()); |
clipboard_echo_filter_.set_host_stub(input_injector_.get()); |
@@ -319,15 +330,18 @@ void ClientSession::OnConnectionAuthenticated( |
CreateVideoEncoder(connection_->session()->config()); |
// Create a VideoScheduler to pump frames from the capturer to the client. |
- video_scheduler_ = new VideoScheduler( |
+ // If cast mode is enabled, do not create it since screen capturer sharing |
+ // has not yet been implemented. |
+ if (!enable_cast_) { |
+ video_scheduler_ = new VideoScheduler( |
video_capture_task_runner_, |
video_encode_task_runner_, |
network_task_runner_, |
- desktop_environment_->CreateVideoCapturer(), |
+ screen_capturer_.Pass(), |
video_encoder.Pass(), |
connection_->client_stub(), |
&mouse_clamping_filter_); |
- |
+ } |
// Create an AudioScheduler if audio is enabled, to pump audio samples. |
if (connection_->session()->config().is_audio_enabled()) { |
scoped_ptr<AudioEncoder> audio_encoder = |
@@ -363,8 +377,10 @@ void ClientSession::OnConnectionChannelsConnected( |
input_injector_->Start(CreateClipboardProxy()); |
SetDisableInputs(false); |
- // Start capturing the screen. |
- video_scheduler_->Start(); |
+ // Start capturing the screen, if cast is not enabled. |
+ if (!enable_cast_) { |
+ video_scheduler_->Start(); |
+ } |
// Start recording audio. |
if (connection_->session()->config().is_audio_enabled()) |