OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/p2p/base/transportcontroller.h" | 11 #include "webrtc/p2p/base/transportcontroller.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 #include "webrtc/base/bind.h" | 15 #include "webrtc/base/bind.h" |
16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
17 #include "webrtc/base/thread.h" | 17 #include "webrtc/base/thread.h" |
18 #include "webrtc/p2p/base/dtlstransport.h" | 18 #include "webrtc/p2p/base/dtlstransport.h" |
19 #include "webrtc/p2p/base/p2ptransport.h" | 19 #include "webrtc/p2p/base/p2ptransport.h" |
20 #include "webrtc/p2p/base/port.h" | 20 #include "webrtc/p2p/base/port.h" |
21 | 21 |
22 #ifdef USE_QUIC | |
23 #include "webrtc/p2p/base/p2ptransportchannel.h" | |
24 #include "webrtc/p2p/quic/quictransportchannel.h" | |
25 #endif // USE_QUIC | |
26 | |
22 namespace cricket { | 27 namespace cricket { |
23 | 28 |
24 enum { | 29 enum { |
25 MSG_ICECONNECTIONSTATE, | 30 MSG_ICECONNECTIONSTATE, |
26 MSG_RECEIVING, | 31 MSG_RECEIVING, |
27 MSG_ICEGATHERINGSTATE, | 32 MSG_ICEGATHERINGSTATE, |
28 MSG_CANDIDATESGATHERED, | 33 MSG_CANDIDATESGATHERED, |
29 }; | 34 }; |
30 | 35 |
31 struct CandidatesData : public rtc::MessageData { | 36 struct CandidatesData : public rtc::MessageData { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 | 217 |
213 const rtc::scoped_refptr<rtc::RTCCertificate>& | 218 const rtc::scoped_refptr<rtc::RTCCertificate>& |
214 TransportController::certificate_for_testing() { | 219 TransportController::certificate_for_testing() { |
215 return certificate_; | 220 return certificate_; |
216 } | 221 } |
217 | 222 |
218 Transport* TransportController::CreateTransport_w( | 223 Transport* TransportController::CreateTransport_w( |
219 const std::string& transport_name) { | 224 const std::string& transport_name) { |
220 RTC_DCHECK(worker_thread_->IsCurrent()); | 225 RTC_DCHECK(worker_thread_->IsCurrent()); |
221 | 226 |
227 #ifdef USE_QUIC | |
228 if (quic_) { | |
229 ice_transport_channel_.reset( | |
Taylor Brandstetter
2016/04/01 23:23:42
If you decide to force "one QUIC channel per PeerC
mikescarlett
2016/04/05 19:58:52
This uses QuicTransport now. QuicTransport owns th
| |
230 new P2PTransportChannel(transport_name, 0, port_allocator())); | |
231 quic_transport_channel_ = | |
232 new QuicTransportChannel(ice_transport_channel_.get()); | |
233 return quic_transport_channel_; | |
234 } | |
235 #endif // USE_QUIC | |
222 Transport* transport = new DtlsTransport<P2PTransport>( | 236 Transport* transport = new DtlsTransport<P2PTransport>( |
223 transport_name, port_allocator(), certificate_); | 237 transport_name, port_allocator(), certificate_); |
224 return transport; | 238 return transport; |
225 } | 239 } |
226 | 240 |
227 Transport* TransportController::GetTransport_w( | 241 Transport* TransportController::GetTransport_w( |
228 const std::string& transport_name) { | 242 const std::string& transport_name) { |
229 RTC_DCHECK(worker_thread_->IsCurrent()); | 243 RTC_DCHECK(worker_thread_->IsCurrent()); |
230 | 244 |
231 auto iter = transports_.find(transport_name); | 245 auto iter = transports_.find(transport_name); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
644 new_gathering_state = kIceGatheringGathering; | 658 new_gathering_state = kIceGatheringGathering; |
645 } | 659 } |
646 if (gathering_state_ != new_gathering_state) { | 660 if (gathering_state_ != new_gathering_state) { |
647 gathering_state_ = new_gathering_state; | 661 gathering_state_ = new_gathering_state; |
648 signaling_thread_->Post( | 662 signaling_thread_->Post( |
649 this, MSG_ICEGATHERINGSTATE, | 663 this, MSG_ICEGATHERINGSTATE, |
650 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); | 664 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); |
651 } | 665 } |
652 } | 666 } |
653 | 667 |
668 void TransportController::set_quic(bool use_quic) { | |
669 #ifdef USE_QUIC | |
670 quic_ = use_quic; | |
671 #endif // USE_QUIC | |
pthatcher1
2016/03/30 20:34:50
This doesn't need USE_QUIC, does it?
mikescarlett
2016/04/05 19:58:53
Fixed.
| |
672 } | |
673 | |
674 QuicTransportChannel* TransportController::quic_transport_channel() const { | |
675 #ifdef USE_QUIC | |
676 if (quic_transport_channel_ != nullptr) { | |
677 return quic_transport_channel_; | |
678 } | |
679 #endif // USE_QUIC | |
680 return nullptr; | |
pthatcher1
2016/03/30 20:34:50
We should probably do an RTC_DCHECK if we don't pu
mikescarlett
2016/04/05 19:58:53
This is behind HAVE_QUIC.
| |
681 } | |
682 | |
654 } // namespace cricket | 683 } // namespace cricket |
OLD | NEW |