Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: webrtc/p2p/base/transportcontroller.cc

Issue 1788703003: Reland the CL to remove candidates when doing continual gathering (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/transportcontroller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(const Candidates& candidates,
131 std::string* err) {
132 return worker_thread_->Invoke<bool>(rtc::Bind(
133 &TransportController::RemoveRemoteCandidates_w, this, candidates, err));
134 }
135
130 bool TransportController::ReadyForRemoteCandidates( 136 bool TransportController::ReadyForRemoteCandidates(
131 const std::string& transport_name) { 137 const std::string& transport_name) {
132 return worker_thread_->Invoke<bool>(rtc::Bind( 138 return worker_thread_->Invoke<bool>(rtc::Bind(
133 &TransportController::ReadyForRemoteCandidates_w, this, transport_name)); 139 &TransportController::ReadyForRemoteCandidates_w, this, transport_name));
134 } 140 }
135 141
136 bool TransportController::GetStats(const std::string& transport_name, 142 bool TransportController::GetStats(const std::string& transport_name,
137 TransportStats* stats) { 143 TransportStats* stats) {
138 return worker_thread_->Invoke<bool>( 144 return worker_thread_->Invoke<bool>(
139 rtc::Bind(&TransportController::GetStats_w, this, transport_name, stats)); 145 rtc::Bind(&TransportController::GetStats_w, this, transport_name, stats));
(...skipping 15 matching lines...) Expand all
155 Transport* transport = GetOrCreateTransport_w(transport_name); 161 Transport* transport = GetOrCreateTransport_w(transport_name);
156 TransportChannelImpl* channel = transport->CreateChannel(component); 162 TransportChannelImpl* channel = transport->CreateChannel(component);
157 channel->SignalWritableState.connect( 163 channel->SignalWritableState.connect(
158 this, &TransportController::OnChannelWritableState_w); 164 this, &TransportController::OnChannelWritableState_w);
159 channel->SignalReceivingState.connect( 165 channel->SignalReceivingState.connect(
160 this, &TransportController::OnChannelReceivingState_w); 166 this, &TransportController::OnChannelReceivingState_w);
161 channel->SignalGatheringState.connect( 167 channel->SignalGatheringState.connect(
162 this, &TransportController::OnChannelGatheringState_w); 168 this, &TransportController::OnChannelGatheringState_w);
163 channel->SignalCandidateGathered.connect( 169 channel->SignalCandidateGathered.connect(
164 this, &TransportController::OnChannelCandidateGathered_w); 170 this, &TransportController::OnChannelCandidateGathered_w);
171 channel->SignalCandidatesRemoved.connect(
172 this, &TransportController::OnChannelCandidatesRemoved_w);
165 channel->SignalRoleConflict.connect( 173 channel->SignalRoleConflict.connect(
166 this, &TransportController::OnChannelRoleConflict_w); 174 this, &TransportController::OnChannelRoleConflict_w);
167 channel->SignalConnectionRemoved.connect( 175 channel->SignalConnectionRemoved.connect(
168 this, &TransportController::OnChannelConnectionRemoved_w); 176 this, &TransportController::OnChannelConnectionRemoved_w);
169 channels_.insert(channels_.end(), RefCountedChannel(channel))->AddRef(); 177 channels_.insert(channels_.end(), RefCountedChannel(channel))->AddRef();
170 // Adding a channel could cause aggregate state to change. 178 // Adding a channel could cause aggregate state to change.
171 UpdateAggregateStates_w(); 179 UpdateAggregateStates_w();
172 return channel; 180 return channel;
173 } 181 }
174 182
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 Transport* transport = GetTransport_w(transport_name); 461 Transport* transport = GetTransport_w(transport_name);
454 if (!transport) { 462 if (!transport) {
455 // If we didn't find a transport, that's not an error; 463 // If we didn't find a transport, that's not an error;
456 // it could have been deleted as a result of bundling. 464 // it could have been deleted as a result of bundling.
457 return true; 465 return true;
458 } 466 }
459 467
460 return transport->AddRemoteCandidates(candidates, err); 468 return transport->AddRemoteCandidates(candidates, err);
461 } 469 }
462 470
471 bool TransportController::RemoveRemoteCandidates_w(const Candidates& candidates,
472 std::string* err) {
473 RTC_DCHECK(worker_thread()->IsCurrent());
474 std::map<std::string, Candidates> candidates_by_transport_name;
475 for (const Candidate& cand : candidates) {
476 RTC_DCHECK(!cand.transport_name().empty());
477 candidates_by_transport_name[cand.transport_name()].push_back(cand);
478 }
479
480 bool result = true;
481 for (auto kv : candidates_by_transport_name) {
482 Transport* transport = GetTransport_w(kv.first);
483 if (!transport) {
484 // If we didn't find a transport, that's not an error;
485 // it could have been deleted as a result of bundling.
486 continue;
487 }
488 result &= transport->RemoveRemoteCandidates(kv.second, err);
489 }
490 return result;
491 }
492
463 bool TransportController::ReadyForRemoteCandidates_w( 493 bool TransportController::ReadyForRemoteCandidates_w(
464 const std::string& transport_name) { 494 const std::string& transport_name) {
465 RTC_DCHECK(worker_thread()->IsCurrent()); 495 RTC_DCHECK(worker_thread()->IsCurrent());
466 496
467 Transport* transport = GetTransport_w(transport_name); 497 Transport* transport = GetTransport_w(transport_name);
468 if (!transport) { 498 if (!transport) {
469 return false; 499 return false;
470 } 500 }
471 return transport->ready_for_remote_candidates(); 501 return transport->ready_for_remote_candidates();
472 } 502 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 RTC_DCHECK(false); 541 RTC_DCHECK(false);
512 return; 542 return;
513 } 543 }
514 std::vector<Candidate> candidates; 544 std::vector<Candidate> candidates;
515 candidates.push_back(candidate); 545 candidates.push_back(candidate);
516 CandidatesData* data = 546 CandidatesData* data =
517 new CandidatesData(channel->transport_name(), candidates); 547 new CandidatesData(channel->transport_name(), candidates);
518 signaling_thread_->Post(this, MSG_CANDIDATESGATHERED, data); 548 signaling_thread_->Post(this, MSG_CANDIDATESGATHERED, data);
519 } 549 }
520 550
551 void TransportController::OnChannelCandidatesRemoved_w(
552 TransportChannelImpl* channel,
553 const Candidates& candidates) {
554 invoker_.AsyncInvoke<void>(
555 signaling_thread_,
556 rtc::Bind(&TransportController::OnChannelCandidatesRemoved, this,
557 candidates));
558 }
559
560 void TransportController::OnChannelCandidatesRemoved(
561 const Candidates& candidates) {
562 RTC_DCHECK(signaling_thread_->IsCurrent());
563 SignalCandidatesRemoved(candidates);
564 }
565
521 void TransportController::OnChannelRoleConflict_w( 566 void TransportController::OnChannelRoleConflict_w(
522 TransportChannelImpl* channel) { 567 TransportChannelImpl* channel) {
523 RTC_DCHECK(worker_thread_->IsCurrent()); 568 RTC_DCHECK(worker_thread_->IsCurrent());
524 569
525 if (ice_role_switch_) { 570 if (ice_role_switch_) {
526 LOG(LS_WARNING) 571 LOG(LS_WARNING)
527 << "Repeat of role conflict signal from TransportChannelImpl."; 572 << "Repeat of role conflict signal from TransportChannelImpl.";
528 return; 573 return;
529 } 574 }
530 575
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 645 }
601 if (gathering_state_ != new_gathering_state) { 646 if (gathering_state_ != new_gathering_state) {
602 gathering_state_ = new_gathering_state; 647 gathering_state_ = new_gathering_state;
603 signaling_thread_->Post( 648 signaling_thread_->Post(
604 this, MSG_ICEGATHERINGSTATE, 649 this, MSG_ICEGATHERINGSTATE,
605 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); 650 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state));
606 } 651 }
607 } 652 }
608 653
609 } // namespace cricket 654 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transportcontroller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698