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

Side by Side Diff: remoting/protocol/webrtc_transport.cc

Issue 2146213002: Add support for dynamic channels in WebrtcTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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_transport.h" 5 #include "remoting/protocol/webrtc_transport.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } // namespace 139 } // namespace
140 140
141 WebrtcTransport::WebrtcTransport( 141 WebrtcTransport::WebrtcTransport(
142 rtc::Thread* worker_thread, 142 rtc::Thread* worker_thread,
143 scoped_refptr<TransportContext> transport_context, 143 scoped_refptr<TransportContext> transport_context,
144 EventHandler* event_handler) 144 EventHandler* event_handler)
145 : worker_thread_(worker_thread), 145 : worker_thread_(worker_thread),
146 transport_context_(transport_context), 146 transport_context_(transport_context),
147 event_handler_(event_handler), 147 event_handler_(event_handler),
148 handshake_hmac_(crypto::HMAC::SHA256), 148 handshake_hmac_(crypto::HMAC::SHA256),
149 outgoing_data_stream_adapter_( 149 data_stream_adapter_(
150 true,
151 base::Bind(&WebrtcTransport::Close, base::Unretained(this))),
152 incoming_data_stream_adapter_(
153 false,
154 base::Bind(&WebrtcTransport::Close, base::Unretained(this))), 150 base::Bind(&WebrtcTransport::Close, base::Unretained(this))),
155 weak_factory_(this) { 151 weak_factory_(this) {
156 transport_context_->set_relay_mode(TransportContext::RelayMode::TURN); 152 transport_context_->set_relay_mode(TransportContext::RelayMode::TURN);
157 } 153 }
158 154
159 WebrtcTransport::~WebrtcTransport() {} 155 WebrtcTransport::~WebrtcTransport() {}
160 156
161 void WebrtcTransport::Start( 157 void WebrtcTransport::Start(
162 Authenticator* authenticator, 158 Authenticator* authenticator,
163 SendTransportInfoCallback send_transport_info_callback) { 159 SendTransportInfoCallback send_transport_info_callback) {
(...skipping 27 matching lines...) Expand all
191 webrtc::FakeConstraints constraints; 187 webrtc::FakeConstraints constraints;
192 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, 188 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp,
193 webrtc::MediaConstraintsInterface::kValueTrue); 189 webrtc::MediaConstraintsInterface::kValueTrue);
194 190
195 std::unique_ptr<cricket::PortAllocator> port_allocator = 191 std::unique_ptr<cricket::PortAllocator> port_allocator =
196 transport_context_->port_allocator_factory()->CreatePortAllocator( 192 transport_context_->port_allocator_factory()->CreatePortAllocator(
197 transport_context_); 193 transport_context_);
198 peer_connection_ = peer_connection_factory_->CreatePeerConnection( 194 peer_connection_ = peer_connection_factory_->CreatePeerConnection(
199 rtc_config, &constraints, std::move(port_allocator), nullptr, this); 195 rtc_config, &constraints, std::move(port_allocator), nullptr, this);
200 196
201 outgoing_data_stream_adapter_.Initialize(peer_connection_); 197 data_stream_adapter_.Initialize(peer_connection_);
202 incoming_data_stream_adapter_.Initialize(peer_connection_);
203 198
204 event_handler_->OnWebrtcTransportConnecting(); 199 event_handler_->OnWebrtcTransportConnecting();
205 200
206 if (transport_context_->role() == TransportRole::SERVER) 201 if (transport_context_->role() == TransportRole::SERVER)
207 RequestNegotiation(); 202 RequestNegotiation();
208 } 203 }
209 204
210 bool WebrtcTransport::ProcessTransportInfo(XmlElement* transport_info) { 205 bool WebrtcTransport::ProcessTransportInfo(XmlElement* transport_info) {
211 DCHECK(thread_checker_.CalledOnValidThread()); 206 DCHECK(thread_checker_.CalledOnValidThread());
212 207
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 427
433 void WebrtcTransport::OnRemoveStream( 428 void WebrtcTransport::OnRemoveStream(
434 rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) { 429 rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) {
435 DCHECK(thread_checker_.CalledOnValidThread()); 430 DCHECK(thread_checker_.CalledOnValidThread());
436 event_handler_->OnWebrtcTransportMediaStreamRemoved(stream.get()); 431 event_handler_->OnWebrtcTransportMediaStreamRemoved(stream.get());
437 } 432 }
438 433
439 void WebrtcTransport::OnDataChannel( 434 void WebrtcTransport::OnDataChannel(
440 rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) { 435 rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) {
441 DCHECK(thread_checker_.CalledOnValidThread()); 436 DCHECK(thread_checker_.CalledOnValidThread());
442 incoming_data_stream_adapter_.OnIncomingDataChannel(data_channel); 437 data_stream_adapter_.WrapIncomingDataChannel(
438 data_channel,
439 base::Bind(&EventHandler::OnWebrtcTransportIncomingDataChannel,
440 base::Unretained(event_handler_), data_channel->label()));
443 } 441 }
444 442
445 void WebrtcTransport::OnRenegotiationNeeded() { 443 void WebrtcTransport::OnRenegotiationNeeded() {
446 DCHECK(thread_checker_.CalledOnValidThread()); 444 DCHECK(thread_checker_.CalledOnValidThread());
447 445
448 if (transport_context_->role() == TransportRole::SERVER) { 446 if (transport_context_->role() == TransportRole::SERVER) {
449 RequestNegotiation(); 447 RequestNegotiation();
450 } else { 448 } else {
451 // TODO(sergeyu): Is it necessary to support renegotiation initiated by the 449 // TODO(sergeyu): Is it necessary to support renegotiation initiated by the
452 // client? 450 // client?
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 peer_connection_->Close(); 574 peer_connection_->Close();
577 peer_connection_ = nullptr; 575 peer_connection_ = nullptr;
578 peer_connection_factory_ = nullptr; 576 peer_connection_factory_ = nullptr;
579 577
580 if (error != OK) 578 if (error != OK)
581 event_handler_->OnWebrtcTransportError(error); 579 event_handler_->OnWebrtcTransportError(error);
582 } 580 }
583 581
584 } // namespace protocol 582 } // namespace protocol
585 } // namespace remoting 583 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698