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 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 TransportController::TransportController(rtc::Thread* signaling_thread, | 45 TransportController::TransportController(rtc::Thread* signaling_thread, |
46 rtc::Thread* network_thread, | 46 rtc::Thread* network_thread, |
47 PortAllocator* port_allocator) | 47 PortAllocator* port_allocator) |
48 : signaling_thread_(signaling_thread), | 48 : signaling_thread_(signaling_thread), |
49 network_thread_(network_thread), | 49 network_thread_(network_thread), |
50 port_allocator_(port_allocator) {} | 50 port_allocator_(port_allocator) {} |
51 | 51 |
52 TransportController::~TransportController() { | 52 TransportController::~TransportController() { |
53 network_thread_->Invoke<void>( | 53 network_thread_->Invoke<void>( |
| 54 RTC_FROM_HERE, |
54 rtc::Bind(&TransportController::DestroyAllTransports_n, this)); | 55 rtc::Bind(&TransportController::DestroyAllTransports_n, this)); |
55 signaling_thread_->Clear(this); | 56 signaling_thread_->Clear(this); |
56 } | 57 } |
57 | 58 |
58 bool TransportController::SetSslMaxProtocolVersion( | 59 bool TransportController::SetSslMaxProtocolVersion( |
59 rtc::SSLProtocolVersion version) { | 60 rtc::SSLProtocolVersion version) { |
60 return network_thread_->Invoke<bool>(rtc::Bind( | 61 return network_thread_->Invoke<bool>( |
61 &TransportController::SetSslMaxProtocolVersion_n, this, version)); | 62 RTC_FROM_HERE, rtc::Bind(&TransportController::SetSslMaxProtocolVersion_n, |
| 63 this, version)); |
62 } | 64 } |
63 | 65 |
64 void TransportController::SetIceConfig(const IceConfig& config) { | 66 void TransportController::SetIceConfig(const IceConfig& config) { |
65 network_thread_->Invoke<void>( | 67 network_thread_->Invoke<void>( |
| 68 RTC_FROM_HERE, |
66 rtc::Bind(&TransportController::SetIceConfig_n, this, config)); | 69 rtc::Bind(&TransportController::SetIceConfig_n, this, config)); |
67 } | 70 } |
68 | 71 |
69 void TransportController::SetIceRole(IceRole ice_role) { | 72 void TransportController::SetIceRole(IceRole ice_role) { |
70 network_thread_->Invoke<void>( | 73 network_thread_->Invoke<void>( |
| 74 RTC_FROM_HERE, |
71 rtc::Bind(&TransportController::SetIceRole_n, this, ice_role)); | 75 rtc::Bind(&TransportController::SetIceRole_n, this, ice_role)); |
72 } | 76 } |
73 | 77 |
74 bool TransportController::GetSslRole(const std::string& transport_name, | 78 bool TransportController::GetSslRole(const std::string& transport_name, |
75 rtc::SSLRole* role) { | 79 rtc::SSLRole* role) { |
76 return network_thread_->Invoke<bool>(rtc::Bind( | 80 return network_thread_->Invoke<bool>( |
77 &TransportController::GetSslRole_n, this, transport_name, role)); | 81 RTC_FROM_HERE, rtc::Bind(&TransportController::GetSslRole_n, this, |
| 82 transport_name, role)); |
78 } | 83 } |
79 | 84 |
80 bool TransportController::SetLocalCertificate( | 85 bool TransportController::SetLocalCertificate( |
81 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { | 86 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { |
82 return network_thread_->Invoke<bool>(rtc::Bind( | 87 return network_thread_->Invoke<bool>( |
83 &TransportController::SetLocalCertificate_n, this, certificate)); | 88 RTC_FROM_HERE, rtc::Bind(&TransportController::SetLocalCertificate_n, |
| 89 this, certificate)); |
84 } | 90 } |
85 | 91 |
86 bool TransportController::GetLocalCertificate( | 92 bool TransportController::GetLocalCertificate( |
87 const std::string& transport_name, | 93 const std::string& transport_name, |
88 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) { | 94 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) { |
89 return network_thread_->Invoke<bool>( | 95 return network_thread_->Invoke<bool>( |
90 rtc::Bind(&TransportController::GetLocalCertificate_n, this, | 96 RTC_FROM_HERE, rtc::Bind(&TransportController::GetLocalCertificate_n, |
91 transport_name, certificate)); | 97 this, transport_name, certificate)); |
92 } | 98 } |
93 | 99 |
94 std::unique_ptr<rtc::SSLCertificate> | 100 std::unique_ptr<rtc::SSLCertificate> |
95 TransportController::GetRemoteSSLCertificate( | 101 TransportController::GetRemoteSSLCertificate( |
96 const std::string& transport_name) { | 102 const std::string& transport_name) { |
97 return network_thread_->Invoke<std::unique_ptr<rtc::SSLCertificate>>( | 103 return network_thread_->Invoke<std::unique_ptr<rtc::SSLCertificate>>( |
98 rtc::Bind(&TransportController::GetRemoteSSLCertificate_n, this, | 104 RTC_FROM_HERE, rtc::Bind(&TransportController::GetRemoteSSLCertificate_n, |
99 transport_name)); | 105 this, transport_name)); |
100 } | 106 } |
101 | 107 |
102 bool TransportController::SetLocalTransportDescription( | 108 bool TransportController::SetLocalTransportDescription( |
103 const std::string& transport_name, | 109 const std::string& transport_name, |
104 const TransportDescription& tdesc, | 110 const TransportDescription& tdesc, |
105 ContentAction action, | 111 ContentAction action, |
106 std::string* err) { | 112 std::string* err) { |
107 return network_thread_->Invoke<bool>( | 113 return network_thread_->Invoke<bool>( |
| 114 RTC_FROM_HERE, |
108 rtc::Bind(&TransportController::SetLocalTransportDescription_n, this, | 115 rtc::Bind(&TransportController::SetLocalTransportDescription_n, this, |
109 transport_name, tdesc, action, err)); | 116 transport_name, tdesc, action, err)); |
110 } | 117 } |
111 | 118 |
112 bool TransportController::SetRemoteTransportDescription( | 119 bool TransportController::SetRemoteTransportDescription( |
113 const std::string& transport_name, | 120 const std::string& transport_name, |
114 const TransportDescription& tdesc, | 121 const TransportDescription& tdesc, |
115 ContentAction action, | 122 ContentAction action, |
116 std::string* err) { | 123 std::string* err) { |
117 return network_thread_->Invoke<bool>( | 124 return network_thread_->Invoke<bool>( |
| 125 RTC_FROM_HERE, |
118 rtc::Bind(&TransportController::SetRemoteTransportDescription_n, this, | 126 rtc::Bind(&TransportController::SetRemoteTransportDescription_n, this, |
119 transport_name, tdesc, action, err)); | 127 transport_name, tdesc, action, err)); |
120 } | 128 } |
121 | 129 |
122 void TransportController::MaybeStartGathering() { | 130 void TransportController::MaybeStartGathering() { |
123 network_thread_->Invoke<void>( | 131 network_thread_->Invoke<void>( |
| 132 RTC_FROM_HERE, |
124 rtc::Bind(&TransportController::MaybeStartGathering_n, this)); | 133 rtc::Bind(&TransportController::MaybeStartGathering_n, this)); |
125 } | 134 } |
126 | 135 |
127 bool TransportController::AddRemoteCandidates(const std::string& transport_name, | 136 bool TransportController::AddRemoteCandidates(const std::string& transport_name, |
128 const Candidates& candidates, | 137 const Candidates& candidates, |
129 std::string* err) { | 138 std::string* err) { |
130 return network_thread_->Invoke<bool>( | 139 return network_thread_->Invoke<bool>( |
131 rtc::Bind(&TransportController::AddRemoteCandidates_n, this, | 140 RTC_FROM_HERE, rtc::Bind(&TransportController::AddRemoteCandidates_n, |
132 transport_name, candidates, err)); | 141 this, transport_name, candidates, err)); |
133 } | 142 } |
134 | 143 |
135 bool TransportController::RemoveRemoteCandidates(const Candidates& candidates, | 144 bool TransportController::RemoveRemoteCandidates(const Candidates& candidates, |
136 std::string* err) { | 145 std::string* err) { |
137 return network_thread_->Invoke<bool>(rtc::Bind( | 146 return network_thread_->Invoke<bool>( |
138 &TransportController::RemoveRemoteCandidates_n, this, candidates, err)); | 147 RTC_FROM_HERE, rtc::Bind(&TransportController::RemoveRemoteCandidates_n, |
| 148 this, candidates, err)); |
139 } | 149 } |
140 | 150 |
141 bool TransportController::ReadyForRemoteCandidates( | 151 bool TransportController::ReadyForRemoteCandidates( |
142 const std::string& transport_name) { | 152 const std::string& transport_name) { |
143 return network_thread_->Invoke<bool>(rtc::Bind( | 153 return network_thread_->Invoke<bool>( |
144 &TransportController::ReadyForRemoteCandidates_n, this, transport_name)); | 154 RTC_FROM_HERE, rtc::Bind(&TransportController::ReadyForRemoteCandidates_n, |
| 155 this, transport_name)); |
145 } | 156 } |
146 | 157 |
147 bool TransportController::GetStats(const std::string& transport_name, | 158 bool TransportController::GetStats(const std::string& transport_name, |
148 TransportStats* stats) { | 159 TransportStats* stats) { |
149 return network_thread_->Invoke<bool>( | 160 return network_thread_->Invoke<bool>( |
| 161 RTC_FROM_HERE, |
150 rtc::Bind(&TransportController::GetStats_n, this, transport_name, stats)); | 162 rtc::Bind(&TransportController::GetStats_n, this, transport_name, stats)); |
151 } | 163 } |
152 | 164 |
153 TransportChannel* TransportController::CreateTransportChannel_n( | 165 TransportChannel* TransportController::CreateTransportChannel_n( |
154 const std::string& transport_name, | 166 const std::string& transport_name, |
155 int component) { | 167 int component) { |
156 RTC_DCHECK(network_thread_->IsCurrent()); | 168 RTC_DCHECK(network_thread_->IsCurrent()); |
157 | 169 |
158 auto it = FindChannel_n(transport_name, component); | 170 auto it = FindChannel_n(transport_name, component); |
159 if (it != channels_.end()) { | 171 if (it != channels_.end()) { |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 | 560 |
549 // We should never signal peer-reflexive candidates. | 561 // We should never signal peer-reflexive candidates. |
550 if (candidate.type() == PRFLX_PORT_TYPE) { | 562 if (candidate.type() == PRFLX_PORT_TYPE) { |
551 RTC_DCHECK(false); | 563 RTC_DCHECK(false); |
552 return; | 564 return; |
553 } | 565 } |
554 std::vector<Candidate> candidates; | 566 std::vector<Candidate> candidates; |
555 candidates.push_back(candidate); | 567 candidates.push_back(candidate); |
556 CandidatesData* data = | 568 CandidatesData* data = |
557 new CandidatesData(channel->transport_name(), candidates); | 569 new CandidatesData(channel->transport_name(), candidates); |
558 signaling_thread_->Post(this, MSG_CANDIDATESGATHERED, data); | 570 signaling_thread_->Post(RTC_FROM_HERE, this, MSG_CANDIDATESGATHERED, data); |
559 } | 571 } |
560 | 572 |
561 void TransportController::OnChannelCandidatesRemoved_n( | 573 void TransportController::OnChannelCandidatesRemoved_n( |
562 TransportChannelImpl* channel, | 574 TransportChannelImpl* channel, |
563 const Candidates& candidates) { | 575 const Candidates& candidates) { |
564 invoker_.AsyncInvoke<void>( | 576 invoker_.AsyncInvoke<void>( |
565 signaling_thread_, | 577 RTC_FROM_HERE, signaling_thread_, |
566 rtc::Bind(&TransportController::OnChannelCandidatesRemoved, this, | 578 rtc::Bind(&TransportController::OnChannelCandidatesRemoved, this, |
567 candidates)); | 579 candidates)); |
568 } | 580 } |
569 | 581 |
570 void TransportController::OnChannelCandidatesRemoved( | 582 void TransportController::OnChannelCandidatesRemoved( |
571 const Candidates& candidates) { | 583 const Candidates& candidates) { |
572 RTC_DCHECK(signaling_thread_->IsCurrent()); | 584 RTC_DCHECK(signaling_thread_->IsCurrent()); |
573 SignalCandidatesRemoved(candidates); | 585 SignalCandidatesRemoved(candidates); |
574 } | 586 } |
575 | 587 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 if (any_failed) { | 640 if (any_failed) { |
629 new_connection_state = kIceConnectionFailed; | 641 new_connection_state = kIceConnectionFailed; |
630 } else if (all_completed) { | 642 } else if (all_completed) { |
631 new_connection_state = kIceConnectionCompleted; | 643 new_connection_state = kIceConnectionCompleted; |
632 } else if (all_connected) { | 644 } else if (all_connected) { |
633 new_connection_state = kIceConnectionConnected; | 645 new_connection_state = kIceConnectionConnected; |
634 } | 646 } |
635 if (connection_state_ != new_connection_state) { | 647 if (connection_state_ != new_connection_state) { |
636 connection_state_ = new_connection_state; | 648 connection_state_ = new_connection_state; |
637 signaling_thread_->Post( | 649 signaling_thread_->Post( |
638 this, MSG_ICECONNECTIONSTATE, | 650 RTC_FROM_HERE, this, MSG_ICECONNECTIONSTATE, |
639 new rtc::TypedMessageData<IceConnectionState>(new_connection_state)); | 651 new rtc::TypedMessageData<IceConnectionState>(new_connection_state)); |
640 } | 652 } |
641 | 653 |
642 if (receiving_ != any_receiving) { | 654 if (receiving_ != any_receiving) { |
643 receiving_ = any_receiving; | 655 receiving_ = any_receiving; |
644 signaling_thread_->Post(this, MSG_RECEIVING, | 656 signaling_thread_->Post(RTC_FROM_HERE, this, MSG_RECEIVING, |
645 new rtc::TypedMessageData<bool>(any_receiving)); | 657 new rtc::TypedMessageData<bool>(any_receiving)); |
646 } | 658 } |
647 | 659 |
648 if (all_done_gathering) { | 660 if (all_done_gathering) { |
649 new_gathering_state = kIceGatheringComplete; | 661 new_gathering_state = kIceGatheringComplete; |
650 } else if (any_gathering) { | 662 } else if (any_gathering) { |
651 new_gathering_state = kIceGatheringGathering; | 663 new_gathering_state = kIceGatheringGathering; |
652 } | 664 } |
653 if (gathering_state_ != new_gathering_state) { | 665 if (gathering_state_ != new_gathering_state) { |
654 gathering_state_ = new_gathering_state; | 666 gathering_state_ = new_gathering_state; |
655 signaling_thread_->Post( | 667 signaling_thread_->Post( |
656 this, MSG_ICEGATHERINGSTATE, | 668 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE, |
657 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); | 669 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); |
658 } | 670 } |
659 } | 671 } |
660 | 672 |
661 } // namespace cricket | 673 } // namespace cricket |
OLD | NEW |