Index: remoting/host/client_session.cc |
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc |
index e3a6766e93b3e29d0e4653d01eb6a8440f2af1e2..1c00f42f18c489cc62c549dc070dcf49baf61ee6 100644 |
--- a/remoting/host/client_session.cc |
+++ b/remoting/host/client_session.cc |
@@ -197,9 +197,12 @@ void ClientSession::SetCapabilities( |
VLOG(1) << "Client capabilities: " << *client_capabilities_; |
- // Calculate the set of capabilities enabled by both client and host and |
- // pass it to the desktop environment if it is available. |
desktop_environment_->SetCapabilities(capabilities_); |
+ |
+ if (pending_video_layout_message_) { |
+ connection_->client_stub()->SetVideoLayout(*pending_video_layout_message_); |
+ pending_video_layout_message_.reset(); |
+ } |
} |
void ClientSession::RequestPairing( |
@@ -295,6 +298,26 @@ void ClientSession::OnConnectionAuthenticated( |
clipboard_echo_filter_.set_client_stub(connection_->client_stub()); |
} |
+void ClientSession::OnCreateVideoStreams( |
+ protocol::ConnectionToClient* connection) { |
+ DCHECK(CalledOnValidThread()); |
+ DCHECK_EQ(connection_.get(), connection); |
+ |
+ // Create a VideoStream to pump frames from the capturer to the client. |
+ video_stream_ = connection_->StartVideoStream( |
+ desktop_environment_->CreateVideoCapturer()); |
+ |
+ video_stream_->SetSizeCallback( |
+ base::Bind(&ClientSession::OnScreenSizeChanged, base::Unretained(this))); |
+ |
+ // Apply video-control parameters to the new stream. |
+ video_stream_->SetLosslessEncode(lossless_video_encode_); |
+ video_stream_->SetLosslessColor(lossless_video_color_); |
+ |
+ // Pause capturing if necessary. |
+ video_stream_->Pause(pause_video_); |
+} |
+ |
void ClientSession::OnConnectionChannelsConnected( |
protocol::ConnectionToClient* connection) { |
DCHECK(CalledOnValidThread()); |
@@ -315,20 +338,6 @@ void ClientSession::OnConnectionChannelsConnected( |
new MouseShapePump(desktop_environment_->CreateMouseCursorMonitor(), |
connection_->client_stub())); |
- // Create a VideoStream to pump frames from the capturer to the client. |
- video_stream_ = connection_->StartVideoStream( |
- desktop_environment_->CreateVideoCapturer()); |
- |
- video_stream_->SetSizeCallback( |
- base::Bind(&ClientSession::OnScreenSizeChanged, base::Unretained(this))); |
- |
- // Apply video-control parameters to the new stream. |
- video_stream_->SetLosslessEncode(lossless_video_encode_); |
- video_stream_->SetLosslessColor(lossless_video_color_); |
- |
- // Pause capturing if necessary. |
- video_stream_->Pause(pause_video_); |
- |
// Create an AudioPump if audio is enabled, to pump audio samples. |
if (connection_->session()->config().is_audio_enabled()) { |
scoped_ptr<AudioEncoder> audio_encoder = |
@@ -448,7 +457,13 @@ void ClientSession::OnScreenSizeChanged(const webrtc::DesktopSize& size, |
video_track->set_height(size.height() * kDefaultDpi / dpi.y()); |
video_track->set_x_dpi(dpi.x()); |
video_track->set_y_dpi(dpi.y()); |
- connection_->client_stub()->SetVideoLayout(layout); |
+ |
+ // VideoLayout can be sent only after capabilities negotiation has finished. |
+ if (client_capabilities_) { |
+ connection_->client_stub()->SetVideoLayout(layout); |
+ } else { |
+ pending_video_layout_message_.reset(new protocol::VideoLayout(layout)); |
+ } |
} |
} |