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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 120 } |
121 | 121 |
122 bool TransportController::AddRemoteCandidates(const std::string& transport_name, | 122 bool TransportController::AddRemoteCandidates(const std::string& transport_name, |
123 const Candidates& candidates, | 123 const Candidates& candidates, |
124 std::string* err) { | 124 std::string* err) { |
125 return worker_thread_->Invoke<bool>( | 125 return worker_thread_->Invoke<bool>( |
126 rtc::Bind(&TransportController::AddRemoteCandidates_w, this, | 126 rtc::Bind(&TransportController::AddRemoteCandidates_w, this, |
127 transport_name, candidates, err)); | 127 transport_name, candidates, err)); |
128 } | 128 } |
129 | 129 |
| 130 bool TransportController::RemoveRemoteCandidates( |
| 131 const std::string& transport_name, |
| 132 const Candidates& candidates, |
| 133 std::string* err) { |
| 134 return worker_thread_->Invoke<bool>( |
| 135 rtc::Bind(&TransportController::RemoveRemoteCandidates_w, this, |
| 136 transport_name, candidates, err)); |
| 137 } |
| 138 |
130 bool TransportController::ReadyForRemoteCandidates( | 139 bool TransportController::ReadyForRemoteCandidates( |
131 const std::string& transport_name) { | 140 const std::string& transport_name) { |
132 return worker_thread_->Invoke<bool>(rtc::Bind( | 141 return worker_thread_->Invoke<bool>(rtc::Bind( |
133 &TransportController::ReadyForRemoteCandidates_w, this, transport_name)); | 142 &TransportController::ReadyForRemoteCandidates_w, this, transport_name)); |
134 } | 143 } |
135 | 144 |
136 bool TransportController::GetStats(const std::string& transport_name, | 145 bool TransportController::GetStats(const std::string& transport_name, |
137 TransportStats* stats) { | 146 TransportStats* stats) { |
138 return worker_thread_->Invoke<bool>( | 147 return worker_thread_->Invoke<bool>( |
139 rtc::Bind(&TransportController::GetStats_w, this, transport_name, stats)); | 148 rtc::Bind(&TransportController::GetStats_w, this, transport_name, stats)); |
(...skipping 15 matching lines...) Expand all Loading... |
155 Transport* transport = GetOrCreateTransport_w(transport_name); | 164 Transport* transport = GetOrCreateTransport_w(transport_name); |
156 TransportChannelImpl* channel = transport->CreateChannel(component); | 165 TransportChannelImpl* channel = transport->CreateChannel(component); |
157 channel->SignalWritableState.connect( | 166 channel->SignalWritableState.connect( |
158 this, &TransportController::OnChannelWritableState_w); | 167 this, &TransportController::OnChannelWritableState_w); |
159 channel->SignalReceivingState.connect( | 168 channel->SignalReceivingState.connect( |
160 this, &TransportController::OnChannelReceivingState_w); | 169 this, &TransportController::OnChannelReceivingState_w); |
161 channel->SignalGatheringState.connect( | 170 channel->SignalGatheringState.connect( |
162 this, &TransportController::OnChannelGatheringState_w); | 171 this, &TransportController::OnChannelGatheringState_w); |
163 channel->SignalCandidateGathered.connect( | 172 channel->SignalCandidateGathered.connect( |
164 this, &TransportController::OnChannelCandidateGathered_w); | 173 this, &TransportController::OnChannelCandidateGathered_w); |
| 174 channel->SignalCandidatesRemoved.connect( |
| 175 this, &TransportController::OnChannelCandidatesRemoved_w); |
165 channel->SignalRoleConflict.connect( | 176 channel->SignalRoleConflict.connect( |
166 this, &TransportController::OnChannelRoleConflict_w); | 177 this, &TransportController::OnChannelRoleConflict_w); |
167 channel->SignalConnectionRemoved.connect( | 178 channel->SignalConnectionRemoved.connect( |
168 this, &TransportController::OnChannelConnectionRemoved_w); | 179 this, &TransportController::OnChannelConnectionRemoved_w); |
169 channels_.insert(channels_.end(), RefCountedChannel(channel))->AddRef(); | 180 channels_.insert(channels_.end(), RefCountedChannel(channel))->AddRef(); |
170 // Adding a channel could cause aggregate state to change. | 181 // Adding a channel could cause aggregate state to change. |
171 UpdateAggregateStates_w(); | 182 UpdateAggregateStates_w(); |
172 return channel; | 183 return channel; |
173 } | 184 } |
174 | 185 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 Transport* transport = GetTransport_w(transport_name); | 464 Transport* transport = GetTransport_w(transport_name); |
454 if (!transport) { | 465 if (!transport) { |
455 // If we didn't find a transport, that's not an error; | 466 // If we didn't find a transport, that's not an error; |
456 // it could have been deleted as a result of bundling. | 467 // it could have been deleted as a result of bundling. |
457 return true; | 468 return true; |
458 } | 469 } |
459 | 470 |
460 return transport->AddRemoteCandidates(candidates, err); | 471 return transport->AddRemoteCandidates(candidates, err); |
461 } | 472 } |
462 | 473 |
| 474 bool TransportController::RemoveRemoteCandidates_w( |
| 475 const std::string& transport_name, |
| 476 const Candidates& candidates, |
| 477 std::string* err) { |
| 478 RTC_DCHECK(worker_thread()->IsCurrent()); |
| 479 |
| 480 Transport* transport = GetTransport_w(transport_name); |
| 481 if (!transport) { |
| 482 // If we didn't find a transport, that's not an error; |
| 483 // it could have been deleted as a result of bundling. |
| 484 return true; |
| 485 } |
| 486 |
| 487 return transport->RemoveRemoteCandidates(candidates, err); |
| 488 } |
| 489 |
463 bool TransportController::ReadyForRemoteCandidates_w( | 490 bool TransportController::ReadyForRemoteCandidates_w( |
464 const std::string& transport_name) { | 491 const std::string& transport_name) { |
465 RTC_DCHECK(worker_thread()->IsCurrent()); | 492 RTC_DCHECK(worker_thread()->IsCurrent()); |
466 | 493 |
467 Transport* transport = GetTransport_w(transport_name); | 494 Transport* transport = GetTransport_w(transport_name); |
468 if (!transport) { | 495 if (!transport) { |
469 return false; | 496 return false; |
470 } | 497 } |
471 return transport->ready_for_remote_candidates(); | 498 return transport->ready_for_remote_candidates(); |
472 } | 499 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 RTC_DCHECK(false); | 538 RTC_DCHECK(false); |
512 return; | 539 return; |
513 } | 540 } |
514 std::vector<Candidate> candidates; | 541 std::vector<Candidate> candidates; |
515 candidates.push_back(candidate); | 542 candidates.push_back(candidate); |
516 CandidatesData* data = | 543 CandidatesData* data = |
517 new CandidatesData(channel->transport_name(), candidates); | 544 new CandidatesData(channel->transport_name(), candidates); |
518 signaling_thread_->Post(this, MSG_CANDIDATESGATHERED, data); | 545 signaling_thread_->Post(this, MSG_CANDIDATESGATHERED, data); |
519 } | 546 } |
520 | 547 |
| 548 void TransportController::OnChannelCandidatesRemoved_w( |
| 549 TransportChannelImpl* channel, |
| 550 const Candidates& candidates) { |
| 551 invoker_.AsyncInvoke<void>( |
| 552 signaling_thread_, |
| 553 rtc::Bind(&TransportController::OnChannelCandidatesRemoved, this, |
| 554 channel->transport_name(), candidates)); |
| 555 } |
| 556 |
| 557 void TransportController::OnChannelCandidatesRemoved( |
| 558 const std::string& transport_name, |
| 559 const Candidates& candidates) { |
| 560 RTC_DCHECK(signaling_thread_->IsCurrent()); |
| 561 SignalCandidatesRemoved(transport_name, candidates); |
| 562 } |
| 563 |
521 void TransportController::OnChannelRoleConflict_w( | 564 void TransportController::OnChannelRoleConflict_w( |
522 TransportChannelImpl* channel) { | 565 TransportChannelImpl* channel) { |
523 RTC_DCHECK(worker_thread_->IsCurrent()); | 566 RTC_DCHECK(worker_thread_->IsCurrent()); |
524 | 567 |
525 if (ice_role_switch_) { | 568 if (ice_role_switch_) { |
526 LOG(LS_WARNING) | 569 LOG(LS_WARNING) |
527 << "Repeat of role conflict signal from TransportChannelImpl."; | 570 << "Repeat of role conflict signal from TransportChannelImpl."; |
528 return; | 571 return; |
529 } | 572 } |
530 | 573 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 } | 643 } |
601 if (gathering_state_ != new_gathering_state) { | 644 if (gathering_state_ != new_gathering_state) { |
602 gathering_state_ = new_gathering_state; | 645 gathering_state_ = new_gathering_state; |
603 signaling_thread_->Post( | 646 signaling_thread_->Post( |
604 this, MSG_ICEGATHERINGSTATE, | 647 this, MSG_ICEGATHERINGSTATE, |
605 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); | 648 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); |
606 } | 649 } |
607 } | 650 } |
608 | 651 |
609 } // namespace cricket | 652 } // namespace cricket |
OLD | NEW |