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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « remoting/protocol/webrtc_connection_to_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/protocol/webrtc_connection_to_client.h" 5 #include "remoting/protocol/webrtc_connection_to_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 24 matching lines...) Expand all
35 // TODO(sergeyu): Figure out if we would benefit from using a separate 35 // TODO(sergeyu): Figure out if we would benefit from using a separate
36 // thread as a worker thread. 36 // thread as a worker thread.
37 WebrtcConnectionToClient::WebrtcConnectionToClient( 37 WebrtcConnectionToClient::WebrtcConnectionToClient(
38 std::unique_ptr<protocol::Session> session, 38 std::unique_ptr<protocol::Session> session,
39 scoped_refptr<protocol::TransportContext> transport_context) 39 scoped_refptr<protocol::TransportContext> transport_context)
40 : transport_(jingle_glue::JingleThreadWrapper::current(), 40 : transport_(jingle_glue::JingleThreadWrapper::current(),
41 transport_context, 41 transport_context,
42 this), 42 this),
43 session_(std::move(session)), 43 session_(std::move(session)),
44 control_dispatcher_(new HostControlDispatcher()), 44 control_dispatcher_(new HostControlDispatcher()),
45 event_dispatcher_(new HostEventDispatcher()) { 45 event_dispatcher_(new HostEventDispatcher()),
46 weak_factory_(this) {
46 session_->SetEventHandler(this); 47 session_->SetEventHandler(this);
47 session_->SetTransport(&transport_); 48 session_->SetTransport(&transport_);
48 } 49 }
49 50
50 WebrtcConnectionToClient::~WebrtcConnectionToClient() {} 51 WebrtcConnectionToClient::~WebrtcConnectionToClient() {}
51 52
52 void WebrtcConnectionToClient::SetEventHandler( 53 void WebrtcConnectionToClient::SetEventHandler(
53 ConnectionToClient::EventHandler* event_handler) { 54 ConnectionToClient::EventHandler* event_handler) {
54 DCHECK(thread_checker_.CalledOnValidThread()); 55 DCHECK(thread_checker_.CalledOnValidThread());
55 event_handler_ = event_handler; 56 event_handler_ = event_handler;
(...skipping 18 matching lines...) Expand all
74 } 75 }
75 76
76 std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream( 77 std::unique_ptr<VideoStream> WebrtcConnectionToClient::StartVideoStream(
77 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) { 78 std::unique_ptr<webrtc::DesktopCapturer> desktop_capturer) {
78 std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream()); 79 std::unique_ptr<WebrtcVideoStream> stream(new WebrtcVideoStream());
79 if (!stream->Start(std::move(desktop_capturer), transport_.peer_connection(), 80 if (!stream->Start(std::move(desktop_capturer), transport_.peer_connection(),
80 transport_.peer_connection_factory())) { 81 transport_.peer_connection_factory())) {
81 return nullptr; 82 return nullptr;
82 } 83 }
83 return std::move(stream); 84 return std::move(stream);
84
85 } 85 }
86 86
87 AudioStub* WebrtcConnectionToClient::audio_stub() { 87 AudioStub* WebrtcConnectionToClient::audio_stub() {
88 DCHECK(thread_checker_.CalledOnValidThread()); 88 DCHECK(thread_checker_.CalledOnValidThread());
89 return nullptr; 89 return nullptr;
90 } 90 }
91 91
92 // Return pointer to ClientStub. 92 // Return pointer to ClientStub.
93 ClientStub* WebrtcConnectionToClient::client_stub() { 93 ClientStub* WebrtcConnectionToClient::client_stub() {
94 DCHECK(thread_checker_.CalledOnValidThread()); 94 DCHECK(thread_checker_.CalledOnValidThread());
(...skipping 20 matching lines...) Expand all
115 DCHECK(thread_checker_.CalledOnValidThread()); 115 DCHECK(thread_checker_.CalledOnValidThread());
116 116
117 DCHECK(event_handler_); 117 DCHECK(event_handler_);
118 switch(state) { 118 switch(state) {
119 case Session::INITIALIZING: 119 case Session::INITIALIZING:
120 case Session::CONNECTING: 120 case Session::CONNECTING:
121 case Session::ACCEPTING: 121 case Session::ACCEPTING:
122 case Session::ACCEPTED: 122 case Session::ACCEPTED:
123 // Don't care about these events. 123 // Don't care about these events.
124 break; 124 break;
125
125 case Session::AUTHENTICATING: 126 case Session::AUTHENTICATING:
126 event_handler_->OnConnectionAuthenticating(this); 127 event_handler_->OnConnectionAuthenticating(this);
127 break; 128 break;
128 case Session::AUTHENTICATED: 129
130 case Session::AUTHENTICATED: {
131 base::WeakPtr<WebrtcConnectionToClient> self = weak_factory_.GetWeakPtr();
129 event_handler_->OnConnectionAuthenticated(this); 132 event_handler_->OnConnectionAuthenticated(this);
133
134 // OnConnectionAuthenticated() call above may result in the connection
135 // being torn down.
136 if (self)
137 event_handler_->CreateVideoStreams(this);
130 break; 138 break;
139 }
140
131 case Session::CLOSED: 141 case Session::CLOSED:
132 case Session::FAILED: 142 case Session::FAILED:
133 control_dispatcher_.reset(); 143 control_dispatcher_.reset();
134 event_dispatcher_.reset(); 144 event_dispatcher_.reset();
135 event_handler_->OnConnectionClosed( 145 event_handler_->OnConnectionClosed(
136 this, state == Session::CLOSED ? OK : session_->error()); 146 this, state == Session::CLOSED ? OK : session_->error());
137 break; 147 break;
138 } 148 }
139 } 149 }
140 150
(...skipping 27 matching lines...) Expand all
168 DCHECK(thread_checker_.CalledOnValidThread()); 178 DCHECK(thread_checker_.CalledOnValidThread());
169 179
170 if (control_dispatcher_ && control_dispatcher_->is_connected() && 180 if (control_dispatcher_ && control_dispatcher_->is_connected() &&
171 event_dispatcher_ && event_dispatcher_->is_connected()) { 181 event_dispatcher_ && event_dispatcher_->is_connected()) {
172 event_handler_->OnConnectionChannelsConnected(this); 182 event_handler_->OnConnectionChannelsConnected(this);
173 } 183 }
174 } 184 }
175 185
176 } // namespace protocol 186 } // namespace protocol
177 } // namespace remoting 187 } // namespace remoting
OLDNEW
« 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