tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 424bbaa05a8a810469abf9bd93dc441a6ceb407d
parent a6f9a7b5fa184566d0d143bfdd2fa3902e960d71
Author: Dan Baker <dbaker@mozilla.com>
Date:   Thu, 23 Oct 2025 15:38:41 -0600

Bug 1995393 - Vendor libwebrtc from 36616fbc84

Upstream commit: https://webrtc.googlesource.com/src/+/36616fbc84b87129ccd7da79d66b07ea928a1529
    Add OnIceCandidateRemoved to PeerConnectionObserver

    Introduce the new `OnIceCandidateRemoved(const IceCandidate* candidate)`
    callback to the `PeerConnectionObserver` interface. This replaces the
    existing `OnIceCandidatesRemoved(const std::vector<Candidate>&)` method,
    now deprecated, and used the Candidate type instead of IceCandidate.

    For backward compatibility, the new `OnIceCandidateRemoved` includes a
    default implementation that calls the deprecated plural version.

    Bug: webrtc:42233526
    Change-Id: I55eea23a34f481ad1723fcd25954ec8325a75506
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/403683
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45347}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/api/peer_connection_interface.h | 16++++++++++++++--
Mthird_party/libwebrtc/examples/peerconnection/client/conductor.h | 1+
Mthird_party/libwebrtc/pc/peer_connection.cc | 17++++++-----------
Mthird_party/libwebrtc/pc/peer_connection_factory_unittest.cc | 1+
Mthird_party/libwebrtc/pc/test/integration_test_helpers.h | 3+++
Mthird_party/libwebrtc/pc/test/mock_peer_connection_observers.h | 6++----
Mthird_party/libwebrtc/pc/test/peer_connection_test_wrapper.h | 1+
Mthird_party/libwebrtc/rtc_tools/data_channel_benchmark/peer_connection_client.h | 1+
Mthird_party/libwebrtc/sdk/objc/api/peerconnection/RTCPeerConnection+Private.h | 3+--
Mthird_party/libwebrtc/sdk/objc/api/peerconnection/RTCPeerConnection.mm | 17++++++-----------
Mthird_party/libwebrtc/test/peer_scenario/peer_scenario_client.cc | 9++++-----
Mthird_party/libwebrtc/test/peer_scenario/peer_scenario_client.h | 3+--
13 files changed, 43 insertions(+), 39 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 /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T21:36:06.675378+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T21:38:29.549154+00:00. # base of lastest vendoring -fd3849b8af +36616fbc84 diff --git a/third_party/libwebrtc/api/peer_connection_interface.h b/third_party/libwebrtc/api/peer_connection_interface.h @@ -1321,11 +1321,23 @@ class PeerConnectionObserver { const std::string& /* error_text */) {} // Ice candidates have been removed. - // TODO(honghaiz): Make this a pure virtual method when all its subclasses - // implement it. + [[deprecated("Implement OnIceCandidateRemoved")]] virtual void OnIceCandidatesRemoved( const std::vector<Candidate>& /* candidates */) {} + // Fired when an IceCandidate has been removed. + // TODO(tommi): Make pure virtual when `OnIceCandidatesRemoved` can be + // removed. + virtual void OnIceCandidateRemoved(const IceCandidate* candidate) { + // Backwards compatibility stub implementation while downstream code is + // migrated over to `OnIceCandidateRemoved` and away from + // `OnIceCandidatesRemoved`. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + OnIceCandidatesRemoved({candidate->candidate()}); +#pragma clang diagnostic pop + } + // Called when the ICE connection receiving status changes. virtual void OnIceConnectionReceivingChange(bool /* receiving */) {} diff --git a/third_party/libwebrtc/examples/peerconnection/client/conductor.h b/third_party/libwebrtc/examples/peerconnection/client/conductor.h @@ -84,6 +84,7 @@ class Conductor : public webrtc::PeerConnectionObserver, webrtc::PeerConnectionInterface::IceGatheringState new_state) override {} void OnIceCandidate(const webrtc::IceCandidate* candidate) override; void OnIceConnectionReceivingChange(bool receiving) override {} + void OnIceCandidateRemoved(const webrtc::IceCandidate* candidate) override {} // // PeerConnectionClientObserver implementation. diff --git a/third_party/libwebrtc/pc/peer_connection.cc b/third_party/libwebrtc/pc/peer_connection.cc @@ -2080,19 +2080,14 @@ void PeerConnection::OnIceCandidatesRemoved( if (IsClosed()) { return; } - // Since this callback is based on the Candidate type, and not IceCandidate, - // all candidate instances should have the transport_name() property set to - // `mid`. See BasicPortAllocatorSession::PrunePortsAndRemoveCandidates for - // where the list of candidates is initially gathered. - std::vector<Candidate> candidates_for_notification; - candidates_for_notification.reserve(candidates.size()); - for (Candidate candidate : candidates) { // Create a copy. + + for (Candidate candidate : candidates) { // Get a copy to set the transport. + // For backwards compatibility reasons, all candidate instances still need + // to have the transport_name() property set to the `mid`. candidate.set_transport_name(mid); - candidates_for_notification.push_back(candidate); + IceCandidate c(mid, -1, candidate); + RunWithObserver([&](auto o) { o->OnIceCandidateRemoved(&c); }); } - RunWithObserver([&](auto observer) { - observer->OnIceCandidatesRemoved(candidates_for_notification); - }); } void PeerConnection::OnSelectedCandidatePairChanged( diff --git a/third_party/libwebrtc/pc/peer_connection_factory_unittest.cc b/third_party/libwebrtc/pc/peer_connection_factory_unittest.cc @@ -123,6 +123,7 @@ class NullPeerConnectionObserver : public PeerConnectionObserver { void OnIceGatheringChange( PeerConnectionInterface::IceGatheringState new_state) override {} void OnIceCandidate(const IceCandidate* candidate) override {} + void OnIceCandidateRemoved(const IceCandidate* candidate) override {} }; class MockNetworkManager : public NetworkManager { diff --git a/third_party/libwebrtc/pc/test/integration_test_helpers.h b/third_party/libwebrtc/pc/test/integration_test_helpers.h @@ -1125,6 +1125,9 @@ class PeerConnectionIntegrationWrapper : public PeerConnectionObserver, error_event_ = IceCandidateErrorEvent(address, port, url, error_code, error_text); } + + void OnIceCandidateRemoved(const IceCandidate* candidate) override {} + void OnDataChannel( scoped_refptr<DataChannelInterface> data_channel) override { RTC_LOG(LS_INFO) << debug_name_ << ": OnDataChannel"; diff --git a/third_party/libwebrtc/pc/test/mock_peer_connection_observers.h b/third_party/libwebrtc/pc/test/mock_peer_connection_observers.h @@ -24,7 +24,6 @@ #include <utility> #include <vector> -#include "api/candidate.h" #include "api/data_channel_interface.h" #include "api/jsep.h" #include "api/legacy_stats_types.h" @@ -143,9 +142,8 @@ class MockPeerConnectionObserver : public PeerConnectionObserver { callback_triggered_ = true; } - void OnIceCandidatesRemoved( - const std::vector<Candidate>& candidates) override { - num_candidates_removed_++; + void OnIceCandidateRemoved(const IceCandidate* candidate) override { + ++num_candidates_removed_; callback_triggered_ = true; } diff --git a/third_party/libwebrtc/pc/test/peer_connection_test_wrapper.h b/third_party/libwebrtc/pc/test/peer_connection_test_wrapper.h @@ -99,6 +99,7 @@ class PeerConnectionTestWrapper void OnIceGatheringChange( webrtc::PeerConnectionInterface::IceGatheringState new_state) override {} void OnIceCandidate(const webrtc::IceCandidate* candidate) override; + void OnIceCandidateRemoved(const webrtc::IceCandidate* candidate) override {} // Implements CreateSessionDescriptionObserver. void OnSuccess(webrtc::SessionDescriptionInterface* desc) override; diff --git a/third_party/libwebrtc/rtc_tools/data_channel_benchmark/peer_connection_client.h b/third_party/libwebrtc/rtc_tools/data_channel_benchmark/peer_connection_client.h @@ -88,6 +88,7 @@ class PeerConnectionClient : public PeerConnectionObserver { void OnIceConnectionReceivingChange(bool receiving) override { RTC_LOG(LS_INFO) << __FUNCTION__ << " receiving? " << receiving; } + void OnIceCandidateRemoved(const IceCandidate* candidate) override {} scoped_refptr<PeerConnectionInterface> peer_connection_; std::function<void(scoped_refptr<DataChannelInterface>)> diff --git a/third_party/libwebrtc/sdk/objc/api/peerconnection/RTCPeerConnection+Private.h b/third_party/libwebrtc/sdk/objc/api/peerconnection/RTCPeerConnection+Private.h @@ -62,8 +62,7 @@ class PeerConnectionDelegateAdapter : public PeerConnectionObserver { int error_code, const std::string &error_text) override; - void OnIceCandidatesRemoved( - const std::vector<webrtc::Candidate> &candidates) override; + void OnIceCandidateRemoved(const webrtc::IceCandidate *candidate) override; void OnIceSelectedCandidatePairChanged( const webrtc::CandidatePairChangeEvent &event) override; diff --git a/third_party/libwebrtc/sdk/objc/api/peerconnection/RTCPeerConnection.mm b/third_party/libwebrtc/sdk/objc/api/peerconnection/RTCPeerConnection.mm @@ -354,8 +354,8 @@ void PeerConnectionDelegateAdapter::OnIceCandidateError( } } -void PeerConnectionDelegateAdapter::OnIceCandidatesRemoved( - const std::vector<webrtc::Candidate> &candidates) { +void PeerConnectionDelegateAdapter::OnIceCandidateRemoved( + const webrtc::IceCandidate *c) { RTC_OBJC_TYPE(RTCPeerConnection) *peer_connection = peer_connection_; if (peer_connection == nil) { return; @@ -365,15 +365,10 @@ void PeerConnectionDelegateAdapter::OnIceCandidatesRemoved( if (delegate == nil) { return; } - NSMutableArray *ice_candidates = - [NSMutableArray arrayWithCapacity:candidates.size()]; - for (const auto &candidate : candidates) { - IceCandidate candidate_wrapper(candidate.transport_name(), -1, candidate); - RTC_OBJC_TYPE(RTCIceCandidate) *ice_candidate = - [[RTC_OBJC_TYPE(RTCIceCandidate) alloc] - initWithNativeCandidate:&candidate_wrapper]; - [ice_candidates addObject:ice_candidate]; - } + NSMutableArray *ice_candidates = [NSMutableArray arrayWithCapacity:1]; + RTC_OBJC_TYPE(RTCIceCandidate) *ice_candidate = + [[RTC_OBJC_TYPE(RTCIceCandidate) alloc] initWithNativeCandidate:c]; + [ice_candidates addObject:ice_candidate]; [delegate peerConnection:peer_connection didRemoveIceCandidates:ice_candidates]; } diff --git a/third_party/libwebrtc/test/peer_scenario/peer_scenario_client.cc b/third_party/libwebrtc/test/peer_scenario/peer_scenario_client.cc @@ -21,7 +21,6 @@ #include "absl/container/inlined_vector.h" #include "absl/memory/memory.h" #include "api/audio_options.h" -#include "api/candidate.h" #include "api/create_modular_peer_connection_factory.h" #include "api/data_channel_interface.h" #include "api/enable_media_with_defaults.h" @@ -135,10 +134,10 @@ class LambdaPeerConnectionObserver final : public PeerConnectionObserver { for (const auto& handler : handlers_->on_ice_candidate_error) handler(address, port, url, error_code, error_text); } - void OnIceCandidatesRemoved( - const std::vector<Candidate>& candidates) override { - for (const auto& handler : handlers_->on_ice_candidates_removed) - handler(candidates); + void OnIceCandidateRemoved(const IceCandidate* candidate) override { + for (const auto& handler : handlers_->on_ice_candidates_removed) { + handler(candidate); + } } void OnAddTrack(scoped_refptr<RtpReceiverInterface> receiver, const std::vector<scoped_refptr<MediaStreamInterface>>& diff --git a/third_party/libwebrtc/test/peer_scenario/peer_scenario_client.h b/third_party/libwebrtc/test/peer_scenario/peer_scenario_client.h @@ -19,7 +19,6 @@ #include <vector> #include "api/audio_options.h" -#include "api/candidate.h" #include "api/data_channel_interface.h" #include "api/environment/environment.h" #include "api/field_trials.h" @@ -76,7 +75,7 @@ class PeerScenarioClient { int, const std::string&)>> on_ice_candidate_error; - std::vector<std::function<void(const std::vector<webrtc::Candidate>&)>> + std::vector<std::function<void(const webrtc::IceCandidate*)>> on_ice_candidates_removed; std::vector<std::function<void( webrtc::scoped_refptr<RtpReceiverInterface>,