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

Unified Diff: remoting/protocol/webrtc_connection_to_client.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, 8 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
« no previous file with comments | « remoting/protocol/webrtc_connection_to_client.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/webrtc_connection_to_client.cc
diff --git a/remoting/protocol/webrtc_connection_to_client.cc b/remoting/protocol/webrtc_connection_to_client.cc
index 0d0ed476434c55f526c3fe31c4548c59ba73b842..733fd429388cad96135fb9da1c6d3fcec995f87f 100644
--- a/remoting/protocol/webrtc_connection_to_client.cc
+++ b/remoting/protocol/webrtc_connection_to_client.cc
@@ -42,7 +42,8 @@ WebrtcConnectionToClient::WebrtcConnectionToClient(
this),
session_(std::move(session)),
control_dispatcher_(new HostControlDispatcher()),
- event_dispatcher_(new HostEventDispatcher()) {
+ event_dispatcher_(new HostEventDispatcher()),
+ weak_factory_(this) {
session_->SetEventHandler(this);
session_->SetTransport(&transport_);
}
@@ -81,7 +82,6 @@ std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream(
return nullptr;
}
return std::move(stream);
-
}
AudioStub* WebrtcConnectionToClient::audio_stub() {
@@ -122,12 +122,22 @@ void WebrtcConnectionToClient::OnSessionStateChange(Session::State state) {
case Session::ACCEPTED:
// Don't care about these events.
break;
+
case Session::AUTHENTICATING:
event_handler_->OnConnectionAuthenticating(this);
break;
- case Session::AUTHENTICATED:
+
+ case Session::AUTHENTICATED: {
+ base::WeakPtr<WebrtcConnectionToClient> self = weak_factory_.GetWeakPtr();
event_handler_->OnConnectionAuthenticated(this);
+
+ // OnConnectionAuthenticated() call above may result in the connection
+ // being torn down.
+ if (self)
+ event_handler_->CreateVideoStreams(this);
break;
+ }
+
case Session::CLOSED:
case Session::FAILED:
control_dispatcher_.reset();
« no previous file with comments | « remoting/protocol/webrtc_connection_to_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698