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

Unified Diff: webrtc/api/jsepsessiondescription.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/jsepsessiondescription.h ('k') | webrtc/api/jsepsessiondescription_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/jsepsessiondescription.cc
diff --git a/webrtc/api/jsepsessiondescription.cc b/webrtc/api/jsepsessiondescription.cc
index b47114b9bcd052979f13a19bdea35d3faae6efc5..eb776c86fa7d9bfd3755adac93b4844ad34456d2 100644
--- a/webrtc/api/jsepsessiondescription.cc
+++ b/webrtc/api/jsepsessiondescription.cc
@@ -137,6 +137,20 @@ bool JsepSessionDescription::AddCandidate(
return true;
}
+size_t JsepSessionDescription::RemoveCandidates(
+ const std::vector<cricket::Candidate>& candidates) {
+ size_t num_removed = 0;
+ for (auto& candidate : candidates) {
+ int mediasection_index = GetMediasectionIndex(candidate);
+ if (mediasection_index < 0) {
+ // Not found.
+ continue;
+ }
+ num_removed += candidate_collection_[mediasection_index].remove(candidate);
+ }
+ return num_removed;
+}
+
size_t JsepSessionDescription::number_of_mediasections() const {
if (!description_)
return 0;
@@ -184,4 +198,16 @@ bool JsepSessionDescription::GetMediasectionIndex(
return true;
}
+int JsepSessionDescription::GetMediasectionIndex(
+ const cricket::Candidate& candidate) {
+ // Find the description with a matching transport name of the candidate.
+ const std::string& transport_name = candidate.transport_name();
+ for (size_t i = 0; i < description_->contents().size(); ++i) {
+ if (transport_name == description_->contents().at(i).name) {
+ return static_cast<int>(i);
+ }
+ }
+ return -1;
+}
+
} // namespace webrtc
« no previous file with comments | « webrtc/api/jsepsessiondescription.h ('k') | webrtc/api/jsepsessiondescription_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698