| OLD | NEW |
| 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 "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 ~SetSessionDescriptionObserver() override {} | 92 ~SetSessionDescriptionObserver() override {} |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 ResultCallback result_callback_; | 95 ResultCallback result_callback_; |
| 96 | 96 |
| 97 DISALLOW_COPY_AND_ASSIGN(SetSessionDescriptionObserver); | 97 DISALLOW_COPY_AND_ASSIGN(SetSessionDescriptionObserver); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 } // namespace | 100 } // namespace |
| 101 | 101 |
| 102 WebrtcTransport::WebrtcTransport( | 102 WebrtcTransport::WebrtcTransport(rtc::Thread* worker_thread, |
| 103 rtc::Thread* worker_thread, | 103 PortAllocatorFactory* port_allocator_factory, |
| 104 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 104 TransportRole role) |
| 105 port_allocator_factory, | |
| 106 TransportRole role) | |
| 107 : port_allocator_factory_(port_allocator_factory), | 105 : port_allocator_factory_(port_allocator_factory), |
| 108 role_(role), | 106 role_(role), |
| 109 worker_thread_(worker_thread), | 107 worker_thread_(worker_thread), |
| 110 weak_factory_(this) {} | 108 weak_factory_(this) {} |
| 111 | 109 |
| 112 WebrtcTransport::~WebrtcTransport() {} | 110 WebrtcTransport::~WebrtcTransport() {} |
| 113 | 111 |
| 114 void WebrtcTransport::Start(EventHandler* event_handler, | 112 void WebrtcTransport::Start(EventHandler* event_handler, |
| 115 Authenticator* authenticator) { | 113 Authenticator* authenticator) { |
| 116 DCHECK(thread_checker_.CalledOnValidThread()); | 114 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 131 | 129 |
| 132 webrtc::PeerConnectionInterface::IceServer stun_server; | 130 webrtc::PeerConnectionInterface::IceServer stun_server; |
| 133 stun_server.urls.push_back("stun:stun.l.google.com:19302"); | 131 stun_server.urls.push_back("stun:stun.l.google.com:19302"); |
| 134 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; | 132 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; |
| 135 rtc_config.servers.push_back(stun_server); | 133 rtc_config.servers.push_back(stun_server); |
| 136 | 134 |
| 137 webrtc::FakeConstraints constraints; | 135 webrtc::FakeConstraints constraints; |
| 138 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, | 136 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, |
| 139 webrtc::MediaConstraintsInterface::kValueTrue); | 137 webrtc::MediaConstraintsInterface::kValueTrue); |
| 140 | 138 |
| 139 rtc::scoped_ptr<cricket::PortAllocator> port_allocator( |
| 140 port_allocator_factory_->CreatePortAllocator()); |
| 141 |
| 141 peer_connection_ = peer_connection_factory_->CreatePeerConnection( | 142 peer_connection_ = peer_connection_factory_->CreatePeerConnection( |
| 142 rtc_config, &constraints, port_allocator_factory_, nullptr, this); | 143 rtc_config, &constraints, std::move(port_allocator), nullptr, this); |
| 143 | 144 |
| 144 data_stream_adapter_.Initialize(peer_connection_, | 145 data_stream_adapter_.Initialize(peer_connection_, |
| 145 role_ == TransportRole::SERVER); | 146 role_ == TransportRole::SERVER); |
| 146 | 147 |
| 147 if (role_ == TransportRole::SERVER) | 148 if (role_ == TransportRole::SERVER) |
| 148 RequestNegotiation(); | 149 RequestNegotiation(); |
| 149 } | 150 } |
| 150 | 151 |
| 151 bool WebrtcTransport::ProcessTransportInfo(XmlElement* transport_info) { | 152 bool WebrtcTransport::ProcessTransportInfo(XmlElement* transport_info) { |
| 152 DCHECK(thread_checker_.CalledOnValidThread()); | 153 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 return; | 482 return; |
| 482 } | 483 } |
| 483 } | 484 } |
| 484 pending_incoming_candidates_.clear(); | 485 pending_incoming_candidates_.clear(); |
| 485 } | 486 } |
| 486 } | 487 } |
| 487 | 488 |
| 488 WebrtcTransportFactory::WebrtcTransportFactory( | 489 WebrtcTransportFactory::WebrtcTransportFactory( |
| 489 rtc::Thread* worker_thread, | 490 rtc::Thread* worker_thread, |
| 490 SignalStrategy* signal_strategy, | 491 SignalStrategy* signal_strategy, |
| 491 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 492 scoped_ptr<PortAllocatorFactory> port_allocator_factory, |
| 492 port_allocator_factory, | |
| 493 TransportRole role) | 493 TransportRole role) |
| 494 : worker_thread_(worker_thread), | 494 : worker_thread_(worker_thread), |
| 495 signal_strategy_(signal_strategy), | 495 signal_strategy_(signal_strategy), |
| 496 port_allocator_factory_(port_allocator_factory), | 496 port_allocator_factory_(std::move(port_allocator_factory)), |
| 497 role_(role) {} | 497 role_(role) {} |
| 498 | 498 |
| 499 WebrtcTransportFactory::~WebrtcTransportFactory() {} | 499 WebrtcTransportFactory::~WebrtcTransportFactory() {} |
| 500 | 500 |
| 501 scoped_ptr<Transport> WebrtcTransportFactory::CreateTransport() { | 501 scoped_ptr<Transport> WebrtcTransportFactory::CreateTransport() { |
| 502 return make_scoped_ptr( | 502 return make_scoped_ptr(new WebrtcTransport( |
| 503 new WebrtcTransport(worker_thread_, port_allocator_factory_, role_)); | 503 worker_thread_, port_allocator_factory_.get(), role_)); |
| 504 } | 504 } |
| 505 | 505 |
| 506 } // namespace protocol | 506 } // namespace protocol |
| 507 } // namespace remoting | 507 } // namespace remoting |
| OLD | NEW |