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