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

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

Issue 1785613011: Revert of 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
136 bool TransportController::ReadyForRemoteCandidates( 130 bool TransportController::ReadyForRemoteCandidates(
137 const std::string& transport_name) { 131 const std::string& transport_name) {
138 return worker_thread_->Invoke<bool>(rtc::Bind( 132 return worker_thread_->Invoke<bool>(rtc::Bind(
139 &TransportController::ReadyForRemoteCandidates_w, this, transport_name)); 133 &TransportController::ReadyForRemoteCandidates_w, this, transport_name));
140 } 134 }
141 135
142 bool TransportController::GetStats(const std::string& transport_name, 136 bool TransportController::GetStats(const std::string& transport_name,
143 TransportStats* stats) { 137 TransportStats* stats) {
144 return worker_thread_->Invoke<bool>( 138 return worker_thread_->Invoke<bool>(
145 rtc::Bind(&TransportController::GetStats_w, this, transport_name, stats)); 139 rtc::Bind(&TransportController::GetStats_w, this, transport_name, stats));
(...skipping 15 matching lines...) Expand all
161 Transport* transport = GetOrCreateTransport_w(transport_name); 155 Transport* transport = GetOrCreateTransport_w(transport_name);
162 TransportChannelImpl* channel = transport->CreateChannel(component); 156 TransportChannelImpl* channel = transport->CreateChannel(component);
163 channel->SignalWritableState.connect( 157 channel->SignalWritableState.connect(
164 this, &TransportController::OnChannelWritableState_w); 158 this, &TransportController::OnChannelWritableState_w);
165 channel->SignalReceivingState.connect( 159 channel->SignalReceivingState.connect(
166 this, &TransportController::OnChannelReceivingState_w); 160 this, &TransportController::OnChannelReceivingState_w);
167 channel->SignalGatheringState.connect( 161 channel->SignalGatheringState.connect(
168 this, &TransportController::OnChannelGatheringState_w); 162 this, &TransportController::OnChannelGatheringState_w);
169 channel->SignalCandidateGathered.connect( 163 channel->SignalCandidateGathered.connect(
170 this, &TransportController::OnChannelCandidateGathered_w); 164 this, &TransportController::OnChannelCandidateGathered_w);
171 channel->SignalCandidatesRemoved.connect(
172 this, &TransportController::OnChannelCandidatesRemoved_w);
173 channel->SignalRoleConflict.connect( 165 channel->SignalRoleConflict.connect(
174 this, &TransportController::OnChannelRoleConflict_w); 166 this, &TransportController::OnChannelRoleConflict_w);
175 channel->SignalConnectionRemoved.connect( 167 channel->SignalConnectionRemoved.connect(
176 this, &TransportController::OnChannelConnectionRemoved_w); 168 this, &TransportController::OnChannelConnectionRemoved_w);
177 channels_.insert(channels_.end(), RefCountedChannel(channel))->AddRef(); 169 channels_.insert(channels_.end(), RefCountedChannel(channel))->AddRef();
178 // Adding a channel could cause aggregate state to change. 170 // Adding a channel could cause aggregate state to change.
179 UpdateAggregateStates_w(); 171 UpdateAggregateStates_w();
180 return channel; 172 return channel;
181 } 173 }
182 174
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 Transport* transport = GetTransport_w(transport_name); 453 Transport* transport = GetTransport_w(transport_name);
462 if (!transport) { 454 if (!transport) {
463 // If we didn't find a transport, that's not an error; 455 // If we didn't find a transport, that's not an error;
464 // it could have been deleted as a result of bundling. 456 // it could have been deleted as a result of bundling.
465 return true; 457 return true;
466 } 458 }
467 459
468 return transport->AddRemoteCandidates(candidates, err); 460 return transport->AddRemoteCandidates(candidates, err);
469 } 461 }
470 462
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
493 bool TransportController::ReadyForRemoteCandidates_w( 463 bool TransportController::ReadyForRemoteCandidates_w(
494 const std::string& transport_name) { 464 const std::string& transport_name) {
495 RTC_DCHECK(worker_thread()->IsCurrent()); 465 RTC_DCHECK(worker_thread()->IsCurrent());
496 466
497 Transport* transport = GetTransport_w(transport_name); 467 Transport* transport = GetTransport_w(transport_name);
498 if (!transport) { 468 if (!transport) {
499 return false; 469 return false;
500 } 470 }
501 return transport->ready_for_remote_candidates(); 471 return transport->ready_for_remote_candidates();
502 } 472 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 RTC_DCHECK(false); 511 RTC_DCHECK(false);
542 return; 512 return;
543 } 513 }
544 std::vector<Candidate> candidates; 514 std::vector<Candidate> candidates;
545 candidates.push_back(candidate); 515 candidates.push_back(candidate);
546 CandidatesData* data = 516 CandidatesData* data =
547 new CandidatesData(channel->transport_name(), candidates); 517 new CandidatesData(channel->transport_name(), candidates);
548 signaling_thread_->Post(this, MSG_CANDIDATESGATHERED, data); 518 signaling_thread_->Post(this, MSG_CANDIDATESGATHERED, data);
549 } 519 }
550 520
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
566 void TransportController::OnChannelRoleConflict_w( 521 void TransportController::OnChannelRoleConflict_w(
567 TransportChannelImpl* channel) { 522 TransportChannelImpl* channel) {
568 RTC_DCHECK(worker_thread_->IsCurrent()); 523 RTC_DCHECK(worker_thread_->IsCurrent());
569 524
570 if (ice_role_switch_) { 525 if (ice_role_switch_) {
571 LOG(LS_WARNING) 526 LOG(LS_WARNING)
572 << "Repeat of role conflict signal from TransportChannelImpl."; 527 << "Repeat of role conflict signal from TransportChannelImpl.";
573 return; 528 return;
574 } 529 }
575 530
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 } 600 }
646 if (gathering_state_ != new_gathering_state) { 601 if (gathering_state_ != new_gathering_state) {
647 gathering_state_ = new_gathering_state; 602 gathering_state_ = new_gathering_state;
648 signaling_thread_->Post( 603 signaling_thread_->Post(
649 this, MSG_ICEGATHERINGSTATE, 604 this, MSG_ICEGATHERINGSTATE,
650 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); 605 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state));
651 } 606 }
652 } 607 }
653 608
654 } // namespace cricket 609 } // 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