commit 2d8361cdcb01f96fcb544f62c7d2fef44c4357cb
parent d2f9bb9b3166edf4eac7b84c991ca77f27b83250
Author: Dan Baker <dbaker@mozilla.com>
Date: Wed, 19 Nov 2025 17:06:52 -0700
Bug 2000941 - Vendor libwebrtc from 7dfaba1cba
Upstream commit: https://webrtc.googlesource.com/src/+/7dfaba1cba7067e33783d031330df1a3703f281d
replace sigslot signal port error with callbacklist
Bug: webrtc:42222066
Change-Id: Ib4df54b10b2d086e26643251d6f150cdfa78fe9e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/405160
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@{#45521}
Diffstat:
10 files changed, 65 insertions(+), 41 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-27T23:33:42.628359+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-11-20T00:06:37.864023+00:00.
# base of lastest vendoring
-d2eaa5570f
+7dfaba1cba
diff --git a/third_party/libwebrtc/moz-patch-stack/p0001.patch b/third_party/libwebrtc/moz-patch-stack/p0001.patch
@@ -175,7 +175,7 @@ index 8ce03f60f4..7f087ba22d 100644
RTC_GUARDED_BY(network_thread_);
const std::unique_ptr<AsyncDnsResolverFactoryInterface>
diff --git a/p2p/base/port.cc b/p2p/base/port.cc
-index ea6b045a11..c7c1de2ef5 100644
+index a81b94dd28..fb7ce4096b 100644
--- a/p2p/base/port.cc
+++ b/p2p/base/port.cc
@@ -121,7 +121,6 @@ Port::Port(const PortParametersRef& args,
@@ -187,7 +187,7 @@ index ea6b045a11..c7c1de2ef5 100644
generation_(0),
ice_username_fragment_(args.ice_username_fragment),
diff --git a/p2p/base/port.h b/p2p/base/port.h
-index 134d9eb854..1a237be898 100644
+index 9c5ce8c74d..62552f83ec 100644
--- a/p2p/base/port.h
+++ b/p2p/base/port.h
@@ -169,7 +169,6 @@ class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> {
@@ -282,7 +282,7 @@ index 0674a5a320..c74feae432 100644
min_port, max_port, *args.server_address, args.config->credentials,
args.relative_priority, args.config->tls_alpn_protocols,
diff --git a/p2p/client/basic_port_allocator.cc b/p2p/client/basic_port_allocator.cc
-index e288c7122d..ee4762815e 100644
+index 01f022755d..b986a16f17 100644
--- a/p2p/client/basic_port_allocator.cc
+++ b/p2p/client/basic_port_allocator.cc
@@ -567,7 +567,6 @@ bool BasicPortAllocatorSession::CandidatesAllocationDone() const {
diff --git a/third_party/libwebrtc/p2p/base/local_network_access_port_unittest.cc b/third_party/libwebrtc/p2p/base/local_network_access_port_unittest.cc
@@ -132,10 +132,12 @@ class LocalNetworkAccessPortTest
};
auto turn_port = TurnPort::Create(args, /*min_port=*/0, /*max_port=*/0);
- turn_port->SignalPortComplete.connect(
- this, &LocalNetworkAccessPortTest::OnPortComplete);
- turn_port->SignalPortError.connect(
- this, &LocalNetworkAccessPortTest::OnPortError);
+ // The tests wait for either of the callbacks to be fired by checking if
+ // port_ready_ or port_error_ becomes true. If neither happens, the test
+ // will fail after a timeout.
+ turn_port->SubscribePortComplete(
+ [this](Port* port) { OnPortComplete(port); });
+ turn_port->SubscribePortError([this](Port* port) { OnPortError(port); });
return turn_port;
}
@@ -155,10 +157,9 @@ class LocalNetworkAccessPortTest
auto stun_port = StunPort::Create(
params, 0, 0, {SocketAddress(server_address, 5000)}, std::nullopt);
- stun_port->SignalPortComplete.connect(
- this, &LocalNetworkAccessPortTest::OnPortComplete);
- stun_port->SignalPortError.connect(
- this, &LocalNetworkAccessPortTest::OnPortError);
+ stun_port->SubscribePortComplete(
+ [this](Port* port) { OnPortComplete(port); });
+ stun_port->SubscribePortError([this](Port* port) { OnPortError(port); });
return stun_port;
}
diff --git a/third_party/libwebrtc/p2p/base/port.cc b/third_party/libwebrtc/p2p/base/port.cc
@@ -149,11 +149,13 @@ Port::Port(const PortParametersRef& args,
RTC_LOG(LS_INFO) << ToString() << ": Port created with network cost "
<< network_cost_;
- // This is a temporary solution to support SignalCandidateReady signals from
+ // This is a temporary solution to support sigslot 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.
+ // the sigslot directly.
SignalCandidateReady.connect(this, &Port::SendCandidateReadyCallbackList);
+ SignalPortComplete.connect(this, &Port::SendPortCompleteCallbackList);
+ SignalPortError.connect(this, &Port::SendPortErrorCallbackList);
}
Port::~Port() {
@@ -311,7 +313,7 @@ bool Port::MaybeObfuscateAddress(const Candidate& c, bool is_final) {
void Port::FinishAddingAddress(const Candidate& c, bool is_final) {
candidates_.push_back(c);
- SendCandidateReady(c);
+ SignalCandidateReady(this, c);
PostAddAddress(is_final);
}
@@ -322,6 +324,21 @@ void Port::PostAddAddress(bool is_final) {
}
}
+void Port::SubscribePortComplete(absl::AnyInvocable<void(Port*)> callback) {
+ RTC_DCHECK_RUN_ON(thread_);
+ port_complete_callback_list_.AddReceiver(std::move(callback));
+}
+
+void Port::SendPortCompleteCallbackList(Port*) {
+ RTC_DCHECK_RUN_ON(thread_);
+ port_complete_callback_list_.Send(this);
+}
+
+void Port::SendPortErrorCallbackList(Port*) {
+ RTC_DCHECK_RUN_ON(thread_);
+ port_error_callback_list_.Send(this);
+}
+
void Port::SubscribeCandidateError(
std::function<void(Port*, const IceCandidateErrorEvent&)> callback) {
RTC_DCHECK_RUN_ON(thread_);
@@ -344,12 +361,9 @@ void Port::SendCandidateReadyCallbackList(Port*, const Candidate& candidate) {
candidate_ready_callback_list_.Send(this, candidate);
}
-void Port::SendCandidateReady(const Candidate& candidate) {
+void Port::SubscribePortError(absl::AnyInvocable<void(Port*)> callback) {
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);
+ port_error_callback_list_.AddReceiver(std::move(callback));
}
void Port::AddOrReplaceConnection(Connection* conn) {
diff --git a/third_party/libwebrtc/p2p/base/port.h b/third_party/libwebrtc/p2p/base/port.h
@@ -270,8 +270,6 @@ class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> {
// 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.
@@ -285,12 +283,18 @@ class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> {
// SignalPortComplete is sent when port completes the task of candidates
// allocation.
+ void SubscribePortComplete(absl::AnyInvocable<void(Port*)> callback);
sigslot::signal1<Port*> SignalPortComplete;
+
// This signal sent when port fails to allocate candidates and this port
// can't be used in establishing the connections. When port is in shared mode
// and port fails to allocate one of the candidates, port shouldn't send
// this signal as other candidates might be usefull in establishing the
// connection.
+ void SubscribePortError(absl::AnyInvocable<void(Port*)> callback);
+ // 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::signal1<Port*> SignalPortError;
void SubscribePortDestroyed(
@@ -515,6 +519,8 @@ class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> {
LocalNetworkAccessPermissionStatus status);
void SendCandidateReadyCallbackList(Port*, const Candidate&);
+ void SendPortCompleteCallbackList(Port*);
+ void SendPortErrorCallbackList(Port*);
const Environment env_;
TaskQueueBase* const thread_;
@@ -566,6 +572,8 @@ class RTC_EXPORT Port : public PortInterface, public sigslot::has_slots<> {
candidate_error_callback_list_ RTC_GUARDED_BY(thread_);
CallbackList<Port*, const Candidate&> candidate_ready_callback_list_
RTC_GUARDED_BY(thread_);
+ CallbackList<Port*> port_complete_callback_list_ RTC_GUARDED_BY(thread_);
+ CallbackList<Port*> port_error_callback_list_ RTC_GUARDED_BY(thread_);
absl::AnyInvocable<void()> role_conflict_callback_ RTC_GUARDED_BY(thread_);
diff --git a/third_party/libwebrtc/p2p/base/port_unittest.cc b/third_party/libwebrtc/p2p/base/port_unittest.cc
@@ -294,7 +294,7 @@ class TestChannel : public sigslot::has_slots<> {
public:
// Takes ownership of `p1` (but not `p2`).
explicit TestChannel(std::unique_ptr<Port> p1) : port_(std::move(p1)) {
- port_->SignalPortComplete.connect(this, &TestChannel::OnPortComplete);
+ port_->SubscribePortComplete([this](Port* port) { OnPortComplete(port); });
port_->SignalUnknownAddress.connect(this, &TestChannel::OnUnknownAddress);
port_->SubscribePortDestroyed(
[this](PortInterface* port) { OnSrcPortDestroyed(port); });
diff --git a/third_party/libwebrtc/p2p/base/stun_port_unittest.cc b/third_party/libwebrtc/p2p/base/stun_port_unittest.cc
@@ -211,9 +211,10 @@ class StunPortTestBase : public ::testing::Test, public sigslot::has_slots<> {
if (stun_keepalive_lifetime_.has_value()) {
stun_port_->set_stun_keepalive_lifetime(*stun_keepalive_lifetime_);
}
- stun_port_->SignalPortComplete.connect(this,
- &StunPortTestBase::OnPortComplete);
- stun_port_->SignalPortError.connect(this, &StunPortTestBase::OnPortError);
+ stun_port_->SubscribePortComplete(
+ [this](Port* port) { OnPortComplete(port); });
+ stun_port_->SubscribePortError([this](Port* port) { OnPortError(port); });
+
stun_port_->SubscribeCandidateError(
[this](Port* port, const IceCandidateErrorEvent& event) {
OnCandidateError(port, event);
@@ -249,9 +250,9 @@ class StunPortTestBase : public ::testing::Test, public sigslot::has_slots<> {
stun_port_->set_server_addresses(stun_servers);
ASSERT_TRUE(stun_port_ != nullptr);
stun_port_->SetIceTiebreaker(kTiebreakerDefault);
- stun_port_->SignalPortComplete.connect(this,
- &StunPortTestBase::OnPortComplete);
- stun_port_->SignalPortError.connect(this, &StunPortTestBase::OnPortError);
+ stun_port_->SubscribePortComplete(
+ [this](Port* port) { OnPortComplete(port); });
+ stun_port_->SubscribePortError([this](Port* port) { OnPortError(port); });
}
void PrepareAddress() { stun_port_->PrepareAddress(); }
diff --git a/third_party/libwebrtc/p2p/base/turn_port_unittest.cc b/third_party/libwebrtc/p2p/base/turn_port_unittest.cc
@@ -363,9 +363,10 @@ class TurnPortTest : public ::testing::Test,
}
void ConnectSignals() {
- turn_port_->SignalPortComplete.connect(this,
- &TurnPortTest::OnTurnPortComplete);
- turn_port_->SignalPortError.connect(this, &TurnPortTest::OnTurnPortError);
+ turn_port_->SubscribePortComplete(
+ [this](Port* port) { OnTurnPortComplete(port); });
+ turn_port_->SubscribePortError(
+ [this](Port* port) { OnTurnPortError(port); });
turn_port_->SubscribeCandidateError(
[this](Port* port, const IceCandidateErrorEvent& event) {
OnCandidateError(port, event);
@@ -391,8 +392,8 @@ class TurnPortTest : public ::testing::Test,
// UDP port will be controlled.
udp_port_->SetIceRole(ICEROLE_CONTROLLED);
udp_port_->SetIceTiebreaker(kTiebreakerDefault);
- udp_port_->SignalPortComplete.connect(this,
- &TurnPortTest::OnUdpPortComplete);
+ udp_port_->SubscribePortComplete(
+ [this](Port* port) { OnUdpPortComplete(port); });
}
void PrepareTurnAndUdpPorts(ProtocolType protocol_type) {
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->SendCandidateReady(c);
+ port->SignalCandidateReady(port, c);
}
if (CandidatePairable(c, port)) {
@@ -926,12 +926,12 @@ void BasicPortAllocatorSession::AddAllocatedPort(Port* port,
[this](Port* port, const IceCandidateErrorEvent& event) {
OnCandidateError(port, event);
});
- port->SignalPortComplete.connect(this,
- &BasicPortAllocatorSession::OnPortComplete);
+ port->SubscribePortComplete([this](Port* port) { OnPortComplete(port); });
port->SubscribePortDestroyed(
[this](PortInterface* port) { OnPortDestroyed(port); });
- port->SignalPortError.connect(this, &BasicPortAllocatorSession::OnPortError);
+ port->SubscribePortError([this](Port* port) { OnPortError(port); });
+
RTC_LOG(LS_INFO) << port->ToString() << ": Added port to allocator";
port->PrepareAddress();
diff --git a/third_party/libwebrtc/p2p/test/fake_port_allocator.h b/third_party/libwebrtc/p2p/test/fake_port_allocator.h
@@ -186,8 +186,7 @@ class FakePortAllocatorSession : public PortAllocatorSession {
void AddPort(Port* port) {
port->set_component(component());
port->set_generation(generation());
- port->SignalPortComplete.connect(this,
- &FakePortAllocatorSession::OnPortComplete);
+ port->SubscribePortComplete([this](Port* port) { OnPortComplete(port); });
port->PrepareAddress();
ready_ports_.push_back(port);
SignalPortReady(this, port);