| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 ResultCallback result_callback_; | 103 ResultCallback result_callback_; |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(SetSessionDescriptionObserver); | 105 DISALLOW_COPY_AND_ASSIGN(SetSessionDescriptionObserver); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace | 108 } // namespace |
| 109 | 109 |
| 110 WebrtcTransport::WebrtcTransport( | 110 WebrtcTransport::WebrtcTransport( |
| 111 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 111 scoped_refptr<PortAllocatorFactoryInterface> port_allocator_factory, |
| 112 port_allocator_factory, | |
| 113 TransportRole role, | 112 TransportRole role, |
| 114 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner) | 113 scoped_refptr<base::SingleThreadTaskRunner> worker_task_runner) |
| 115 : port_allocator_factory_(port_allocator_factory), | 114 : port_allocator_factory_(port_allocator_factory), |
| 116 role_(role), | 115 role_(role), |
| 117 worker_task_runner_(worker_task_runner), | 116 worker_task_runner_(worker_task_runner), |
| 118 weak_factory_(this) {} | 117 weak_factory_(this) {} |
| 119 | 118 |
| 120 WebrtcTransport::~WebrtcTransport() {} | 119 WebrtcTransport::~WebrtcTransport() {} |
| 121 | 120 |
| 122 void WebrtcTransport::Start(EventHandler* event_handler, | 121 void WebrtcTransport::Start(EventHandler* event_handler, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 242 |
| 244 webrtc::PeerConnectionInterface::IceServer stun_server; | 243 webrtc::PeerConnectionInterface::IceServer stun_server; |
| 245 stun_server.urls.push_back("stun:stun.l.google.com:19302"); | 244 stun_server.urls.push_back("stun:stun.l.google.com:19302"); |
| 246 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; | 245 webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; |
| 247 rtc_config.servers.push_back(stun_server); | 246 rtc_config.servers.push_back(stun_server); |
| 248 | 247 |
| 249 webrtc::FakeConstraints constraints; | 248 webrtc::FakeConstraints constraints; |
| 250 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, | 249 constraints.AddMandatory(webrtc::MediaConstraintsInterface::kEnableDtlsSrtp, |
| 251 webrtc::MediaConstraintsInterface::kValueTrue); | 250 webrtc::MediaConstraintsInterface::kValueTrue); |
| 252 | 251 |
| 252 rtc::scoped_ptr<cricket::PortAllocator> port_allocator( |
| 253 port_allocator_factory_->CreatePortAllocator()); |
| 254 |
| 253 peer_connection_ = peer_connection_factory_->CreatePeerConnection( | 255 peer_connection_ = peer_connection_factory_->CreatePeerConnection( |
| 254 rtc_config, &constraints, port_allocator_factory_, nullptr, this); | 256 rtc_config, &constraints, std::move(port_allocator), nullptr, this); |
| 255 | 257 |
| 256 data_stream_adapter_.Initialize(peer_connection_, | 258 data_stream_adapter_.Initialize(peer_connection_, |
| 257 role_ == TransportRole::SERVER); | 259 role_ == TransportRole::SERVER); |
| 258 | 260 |
| 259 if (role_ == TransportRole::CLIENT) { | 261 if (role_ == TransportRole::CLIENT) { |
| 260 webrtc::FakeConstraints offer_config; | 262 webrtc::FakeConstraints offer_config; |
| 261 offer_config.AddMandatory( | 263 offer_config.AddMandatory( |
| 262 webrtc::MediaConstraintsInterface::kOfferToReceiveVideo, | 264 webrtc::MediaConstraintsInterface::kOfferToReceiveVideo, |
| 263 webrtc::MediaConstraintsInterface::kValueTrue); | 265 webrtc::MediaConstraintsInterface::kValueTrue); |
| 264 offer_config.AddMandatory( | 266 offer_config.AddMandatory( |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 Close(INCOMPATIBLE_PROTOCOL); | 468 Close(INCOMPATIBLE_PROTOCOL); |
| 467 return; | 469 return; |
| 468 } | 470 } |
| 469 } | 471 } |
| 470 pending_incoming_candidates_.clear(); | 472 pending_incoming_candidates_.clear(); |
| 471 } | 473 } |
| 472 } | 474 } |
| 473 | 475 |
| 474 WebrtcTransportFactory::WebrtcTransportFactory( | 476 WebrtcTransportFactory::WebrtcTransportFactory( |
| 475 SignalStrategy* signal_strategy, | 477 SignalStrategy* signal_strategy, |
| 476 rtc::scoped_refptr<webrtc::PortAllocatorFactoryInterface> | 478 scoped_refptr<PortAllocatorFactoryInterface> port_allocator_factory, |
| 477 port_allocator_factory, | |
| 478 TransportRole role) | 479 TransportRole role) |
| 479 : signal_strategy_(signal_strategy), | 480 : signal_strategy_(signal_strategy), |
| 480 port_allocator_factory_(port_allocator_factory), | 481 port_allocator_factory_(port_allocator_factory), |
| 481 role_(role), | 482 role_(role), |
| 482 worker_thread_("ChromotingWebrtcWorkerThread") { | 483 worker_thread_("ChromotingWebrtcWorkerThread") { |
| 483 worker_thread_.StartWithOptions( | 484 worker_thread_.StartWithOptions( |
| 484 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | 485 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); |
| 485 } | 486 } |
| 486 | 487 |
| 487 WebrtcTransportFactory::~WebrtcTransportFactory() {} | 488 WebrtcTransportFactory::~WebrtcTransportFactory() {} |
| 488 | 489 |
| 489 scoped_ptr<Transport> WebrtcTransportFactory::CreateTransport() { | 490 scoped_ptr<Transport> WebrtcTransportFactory::CreateTransport() { |
| 490 return make_scoped_ptr(new WebrtcTransport(port_allocator_factory_, role_, | 491 return make_scoped_ptr(new WebrtcTransport(port_allocator_factory_, role_, |
| 491 worker_thread_.task_runner())); | 492 worker_thread_.task_runner())); |
| 492 } | 493 } |
| 493 | 494 |
| 494 } // namespace protocol | 495 } // namespace protocol |
| 495 } // namespace remoting | 496 } // namespace remoting |
| OLD | NEW |