Chromium Code Reviews| Index: remoting/host/client_session.cc |
| diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc |
| index e3a6766e93b3e29d0e4653d01eb6a8440f2af1e2..e42a56ac2cd512a7a560720bd42260df84785dea 100644 |
| --- a/remoting/host/client_session.cc |
| +++ b/remoting/host/client_session.cc |
| @@ -79,9 +79,6 @@ ClientSession::ClientSession( |
| max_duration_(max_duration), |
| audio_task_runner_(audio_task_runner), |
| pairing_registry_(pairing_registry), |
| - is_authenticated_(false), |
| - pause_video_(false), |
| - lossless_video_encode_(false), |
| // Note that |lossless_video_color_| defaults to true, but actually only |
| // controls VP9 video stream color quality. |
| lossless_video_color_(!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| @@ -197,8 +194,6 @@ 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_); |
| } |
| @@ -295,11 +290,34 @@ void ClientSession::OnConnectionAuthenticated( |
| clipboard_echo_filter_.set_client_stub(connection_->client_stub()); |
| } |
| +void ClientSession::CreateVideoStreams( |
| + 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()); |
| DCHECK_EQ(connection_.get(), connection); |
| + DCHECK(!channels_connected_); |
| + channels_connected_ = true; |
| + |
| // Negotiate capabilities with the client. |
| VLOG(1) << "Host capabilities: " << host_capabilities_; |
| protocol::Capabilities capabilities; |
| @@ -315,20 +333,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 = |
| @@ -338,6 +342,11 @@ void ClientSession::OnConnectionChannelsConnected( |
| std::move(audio_encoder), connection_->audio_stub())); |
| } |
| + if (pending_video_layout_message_) { |
| + connection_->client_stub()->SetVideoLayout(*pending_video_layout_message_); |
| + pending_video_layout_message_.reset(); |
| + } |
| + |
| // Notify the event handler that all our channels are now connected. |
| event_handler_->OnSessionChannelsConnected(this); |
| } |
| @@ -448,7 +457,14 @@ 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 the control channel is connected. This |
| + // is necessary for the case in the future. |
|
Jamie
2016/04/05 21:46:35
I don't understand this second sentence. Are you s
Sergey Ulanov
2016/04/06 21:23:50
I don't understand it either :-/. Removed.
|
| + if (channels_connected_) { |
| + connection_->client_stub()->SetVideoLayout(layout); |
| + } else { |
| + pending_video_layout_message_.reset(new protocol::VideoLayout(layout)); |
| + } |
| } |
| } |