commit 98751437580b6f3f6241e4fe056c4b73c07c34ba
parent 196a817e95af00ed4e93709cc151b02b5d284eda
Author: Michael Froman <mfroman@mozilla.com>
Date: Thu, 9 Oct 2025 23:30:49 -0500
Bug 1993083 - Vendor libwebrtc from afbc6b30c4
Upstream commit: https://webrtc.googlesource.com/src/+/afbc6b30c4dfb76d45a141b0fe43281ac473d1ce
Merge RemoveIceCandidates and RemoveIceCandidate (singular) code paths
Bug: webrtc:42233526
Change-Id: Idf6c0cb05e866a9549ffd4b16538f9145fbb20d4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/402060
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45216}
Diffstat:
5 files changed, 21 insertions(+), 47 deletions(-)
diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor
@@ -1,4 +1,4 @@
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
-libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-10T04:29:34.924705+00:00.
+libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-10T04:30:39.857549+00:00.
# base of lastest vendoring
-e9b14fb1eb
+afbc6b30c4
diff --git a/third_party/libwebrtc/pc/jsep_session_description_unittest.cc b/third_party/libwebrtc/pc/jsep_session_description_unittest.cc
@@ -518,21 +518,15 @@ TEST_F(JsepSessionDescriptionTest, RemoveCandidateAndSetConnectionAddress) {
ASSERT_TRUE(jsep_desc_->AddCandidate(&jice2));
ASSERT_TRUE(jsep_desc_->AddCandidate(&jice3));
- std::vector<Candidate> candidates;
EXPECT_EQ("192.168.1.1:1236", media_desc->connection_address().ToString());
- candidates.push_back(candidate3);
- ASSERT_TRUE(jsep_desc_->RemoveCandidates("audio", candidates));
+ ASSERT_TRUE(jsep_desc_->RemoveCandidate(&jice3));
EXPECT_EQ("[::1]:1234", media_desc->connection_address().ToString());
- candidates.clear();
- candidates.push_back(candidate2);
- ASSERT_TRUE(jsep_desc_->RemoveCandidates("audio", candidates));
+ ASSERT_TRUE(jsep_desc_->RemoveCandidate(&jice2));
EXPECT_EQ("[::1]:1234", media_desc->connection_address().ToString());
- candidates.clear();
- candidates.push_back(candidate1);
- ASSERT_TRUE(jsep_desc_->RemoveCandidates("audio", candidates));
+ ASSERT_TRUE(jsep_desc_->RemoveCandidate(&jice1));
EXPECT_EQ("0.0.0.0:9", media_desc->connection_address().ToString());
}
diff --git a/third_party/libwebrtc/pc/jsep_transport_controller_unittest.cc b/third_party/libwebrtc/pc/jsep_transport_controller_unittest.cc
@@ -588,7 +588,8 @@ TEST_F(JsepTransportControllerTest, AddRemoveRemoteCandidates) {
EXPECT_EQ(1U,
fake_audio_dtls->fake_ice_transport()->remote_candidates().size());
- EXPECT_TRUE(transport_controller_->RemoveRemoteCandidates(candidates).ok());
+ IceCandidate ice_candidate(kAudioMid1, -1, candidates[0]);
+ EXPECT_TRUE(transport_controller_->RemoveRemoteCandidate(&ice_candidate));
EXPECT_EQ(0U,
fake_audio_dtls->fake_ice_transport()->remote_candidates().size());
}
diff --git a/third_party/libwebrtc/pc/sdp_offer_answer.cc b/third_party/libwebrtc/pc/sdp_offer_answer.cc
@@ -3009,40 +3009,15 @@ bool SdpOfferAnswerHandler::RemoveIceCandidates(
const std::vector<Candidate>& candidates) {
TRACE_EVENT0("webrtc", "SdpOfferAnswerHandler::RemoveIceCandidates");
RTC_DCHECK_RUN_ON(signaling_thread());
- if (pc_->IsClosed()) {
- RTC_LOG(LS_ERROR) << "RemoveIceCandidates: PeerConnection is closed.";
- return false;
- }
-
- if (!remote_description()) {
- RTC_LOG(LS_ERROR) << "RemoveIceCandidates: No remote description.";
- return false;
- }
-
- if (candidates.empty()) {
- RTC_LOG(LS_ERROR) << "RemoveIceCandidates: No candidates.";
- return false;
- }
- size_t number_removed = 0u;
for (const auto& c : candidates) {
- number_removed +=
- mutable_remote_description()->RemoveCandidates(c.transport_name(), {c});
- }
- if (number_removed != candidates.size()) {
- RTC_LOG(LS_ERROR)
- << "RemoveIceCandidates: Failed to remove candidates. Requested "
- << candidates.size() << " but only " << number_removed
- << " were removed.";
+ IceCandidate candidate(c.transport_name(), /*sdp_mline_index=*/-1, c);
+ if (!RemoveIceCandidate(&candidate)) {
+ RTC_LOG(LS_ERROR) << "RemoveIceCandidates: Failed to remove candidate: "
+ << c.ToSensitiveString();
+ }
}
- // Remove the candidates from the transport controller.
- RTCError error = transport_controller_s()->RemoveRemoteCandidates(candidates);
- if (!error.ok()) {
- RTC_LOG(LS_ERROR)
- << "RemoveIceCandidates: Error when removing remote candidates: "
- << error.message();
- }
// Technically it would be more correct to return `number_removed != 0u` here,
// but some downstream code needs to be updated first.
return true;
@@ -3061,7 +3036,10 @@ void SdpOfferAnswerHandler::RemoveLocalIceCandidates(
const std::vector<Candidate>& candidates) {
RTC_DCHECK_RUN_ON(signaling_thread());
if (local_description()) {
- mutable_local_description()->RemoveCandidates(mid, candidates);
+ for (const auto& c : candidates) {
+ IceCandidate ice_candidate(mid, -1, c);
+ mutable_local_description()->RemoveCandidate(&ice_candidate);
+ }
}
}
diff --git a/third_party/libwebrtc/pc/webrtc_sdp_unittest.cc b/third_party/libwebrtc/pc/webrtc_sdp_unittest.cc
@@ -1081,11 +1081,12 @@ class WebRtcSdpTest : public ::testing::Test {
const IceCandidateCollection* video_candidates_collection =
jdesc_.candidates(1);
ASSERT_NE(nullptr, video_candidates_collection);
- std::vector<Candidate> video_candidates;
- for (const auto& c : video_candidates_collection->candidates()) {
- video_candidates.push_back(c->candidate());
+ // Since this loop modifies video_candidates_collection, just loop until
+ // it's empty instead of using a for loop.
+ while (!video_candidates_collection->candidates().empty()) {
+ ASSERT_TRUE(jdesc_.RemoveCandidate(
+ video_candidates_collection->candidates().back().get()));
}
- jdesc_.RemoveCandidates("video_content_name", video_candidates);
}
// Turns the existing reference description into a description using