commit 1970bf8c018d946c36da9d1895cba813909232a0
parent 8a0bafec6cd8d0090e5db6730fa2a77555f1cf65
Author: Dan Baker <dbaker@mozilla.com>
Date: Mon, 27 Oct 2025 14:13:52 -0600
Bug 1995393 - Vendor libwebrtc from bb00360f36
Upstream commit: https://webrtc.googlesource.com/src/+/bb00360f360ba19f0c6aad26c1a18353b9e71546
Prepare to replace sigslot signal candidate ready with callbacklist
Bug: webrtc:42222066
Change-Id: Ib8c109a22a78fcc2da15c7d9b641427addea38b3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/405260
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Lena Kaplan <lenakaplan@meta.com>
Cr-Commit-Position: refs/heads/main@{#45455}
Diffstat:
4 files changed, 42 insertions(+), 6 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-27T20:11:42.725719+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-27T20:13:41.696729+00:00.
# base of lastest vendoring
-bc0e21e2b6
+bb00360f36
diff --git a/third_party/libwebrtc/p2p/base/port.cc b/third_party/libwebrtc/p2p/base/port.cc
@@ -304,7 +304,7 @@ bool Port::MaybeObfuscateAddress(const Candidate& c, bool is_final) {
void Port::FinishAddingAddress(const Candidate& c, bool is_final) {
candidates_.push_back(c);
- SignalCandidateReady(this, c);
+ SendCandidateReady(c);
PostAddAddress(is_final);
}
@@ -326,6 +326,25 @@ void Port::SendCandidateError(const IceCandidateErrorEvent& event) {
candidate_error_callback_list_.Send(this, event);
}
+void Port::SubscribeCandidateReadyCallback(
+ absl::AnyInvocable<void(Port*, const Candidate&)> callback) {
+ RTC_DCHECK_RUN_ON(thread_);
+ candidate_ready_callback_list_.AddReceiver(std::move(callback));
+}
+
+void Port::SendCandidateReadyCallbackList(Port*, const Candidate& candidate) {
+ RTC_DCHECK_RUN_ON(thread_);
+ candidate_ready_callback_list_.Send(this, candidate);
+}
+
+void Port::SendCandidateReady(const Candidate& candidate) {
+ RTC_DCHECK_RUN_ON(thread_);
+ // Once we remove SignalCandidateReady we'll replace the invocation of
+ // SignalCandidateReady callback with
+ // candidate_ready_callback_list_.Send(this, c);
+ SignalCandidateReady(this, candidate);
+}
+
void Port::AddOrReplaceConnection(Connection* conn) {
RTC_DCHECK_RUN_ON(thread_);
auto ret = connections_.insert(
diff --git a/third_party/libwebrtc/p2p/base/port.h b/third_party/libwebrtc/p2p/base/port.h
@@ -268,7 +268,16 @@ class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> {
// Fired when candidates are discovered by the port. When all candidates
// are discovered that belong to port SignalAddressReady is fired.
+ void SubscribeCandidateReadyCallback(
+ absl::AnyInvocable<void(Port*, const Candidate&)> callback);
+
+ void SendCandidateReady(const Candidate& candidate);
+ // Downstream code uses this signal. We will continue firing it along with the
+ // callback list. The signal can be deleted once all downstream usages are
+ // replaced with the new CallbackList implementation.
sigslot::signal2<Port*, const Candidate&> SignalCandidateReady;
+ void SendCandidateReadyCallbackList(Port*, const Candidate&);
+
// Provides all of the above information in one handy object.
const std::vector<Candidate>& Candidates() const override;
// Fired when candidate discovery failed using certain server.
@@ -551,6 +560,8 @@ class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> {
RTC_GUARDED_BY(thread_);
CallbackList<Port*, const IceCandidateErrorEvent&>
candidate_error_callback_list_ RTC_GUARDED_BY(thread_);
+ CallbackList<Port*, const Candidate&> candidate_ready_callback_list_
+ RTC_GUARDED_BY(thread_);
// Keep as the last member variable.
WeakPtrFactory<Port> weak_factory_ RTC_GUARDED_BY(thread_);
diff --git a/third_party/libwebrtc/p2p/client/basic_port_allocator.cc b/third_party/libwebrtc/p2p/client/basic_port_allocator.cc
@@ -338,7 +338,7 @@ void BasicPortAllocatorSession::SetCandidateFilter(uint32_t filter) {
found_signalable_candidate = true;
port_data.set_state(PortData::STATE_INPROGRESS);
}
- port->SignalCandidateReady(port, c);
+ port->SendCandidateReady(c);
}
if (CandidatePairable(c, port)) {
@@ -920,8 +920,14 @@ void BasicPortAllocatorSession::AddAllocatedPort(Port* port,
PortData data(port, seq);
ports_.push_back(data);
- port->SignalCandidateReady.connect(
- this, &BasicPortAllocatorSession::OnCandidateReady);
+ // This is a temporary solution to support SignalCandidateReady signals from
+ // downstream. We also register a method to send the callbacks in callback
+ // list. This will no longer be needed once downstream stops using
+ // SignalCandidateReady.
+ port->SignalCandidateReady.connect(port,
+ &Port::SendCandidateReadyCallbackList);
+ port->SubscribeCandidateReadyCallback(
+ [this](Port* port, const Candidate& c) { OnCandidateReady(port, c); });
port->SubscribeCandidateError(
[this](Port* port, const IceCandidateErrorEvent& event) {
OnCandidateError(port, event);