Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(660)

Unified Diff: remoting/host/client_session.cc

Issue 1852033002: Fix WebRTC transport to use single offer-answer exchange instead of two. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_cast
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698