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

Unified Diff: webrtc/p2p/base/p2ptransportchannel.cc

Issue 1648813004: Remove candidates when doing continual gathering (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: small fixes Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/base/p2ptransportchannel.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
index d6f3cbc3d20d84b85335ec541d58aad909e96db9..da7eca1099dc166ff4c4ac0f4853d8930958a8f0 100644
--- a/webrtc/p2p/base/p2ptransportchannel.cc
+++ b/webrtc/p2p/base/p2ptransportchannel.cc
@@ -761,6 +761,19 @@ void P2PTransportChannel::AddRemoteCandidate(const Candidate& candidate) {
SortConnections();
}
+void P2PTransportChannel::RemoveRemoteCandidate(
+ const Candidate& cand_to_remove) {
+ auto iter =
+ std::remove_if(remote_candidates_.begin(), remote_candidates_.end(),
+ [cand_to_remove](const Candidate& candidate) {
+ return cand_to_remove.MatchesForRemoval(candidate);
+ });
+ if (iter != remote_candidates_.end()) {
+ LOG(LS_VERBOSE) << "Removed remote candidate " << cand_to_remove.ToString();
+ remote_candidates_.erase(iter, remote_candidates_.end());
+ }
+}
+
// Creates connections from all of the ports that we care about to the given
// remote candidate. The return value is true if we created a connection from
// the origin port.
@@ -1447,7 +1460,11 @@ void P2PTransportChannel::OnPortNetworkInactive(PortInterface* port) {
ports_.erase(it);
LOG(INFO) << "Removed port due to inactive networks: " << ports_.size()
<< " remaining";
- // TODO(honghaiz): Signal candidate removals to the remote side.
+ std::vector<Candidate> candidates = port->Candidates();
+ for (Candidate& candidate : candidates) {
+ candidate.set_transport_name(transport_name());
+ }
+ SignalCandidatesRemoved(this, candidates);
}
// We data is available, let listeners know

Powered by Google App Engine
This is Rietveld 408576698