commit 0287b5d82140d453c66467a51fbb914f3ad9cfed
parent c2795cd0a2d182ce61c87a2673651cd714e050c9
Author: Michael Froman <mfroman@mozilla.com>
Date: Wed, 8 Oct 2025 22:19:49 -0500
Bug 1993083 - Vendor libwebrtc from 13213ef82c
(skip-generation)
Upstream commit: https://webrtc.googlesource.com/src/+/13213ef82c6027eb7d825806190644bada94db78
Introduce create_modular_peer_connection_factory build target
The new target contains not just the declaration of the
CreateModularPeerConnectionFactory, but also includes all the right dependencies to have definition of that function.
Thus users of the new build target won't need to guess what extra build targets they need to depend on to be able to link.
Bug: webrtc:42220069
Change-Id: I9707446d5ebf933455db3b51be1a789ba2ec8017
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/399180
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45098}
Diffstat:
10 files changed, 132 insertions(+), 42 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-09T03:07:00.829353+00:00.
+libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-09T03:19:38.336091+00:00.
# base of lastest vendoring
-6d7602d212
+13213ef82c
diff --git a/third_party/libwebrtc/api/BUILD.gn b/third_party/libwebrtc/api/BUILD.gn
@@ -73,6 +73,19 @@ rtc_library("enable_media_with_defaults") {
]
}
+rtc_source_set("create_modular_peer_connection_factory") {
+ visibility = [ "*" ]
+ allow_poison = [ "environment_construction" ]
+ sources = [ "create_modular_peer_connection_factory.h" ]
+ deps = [
+ ":libjingle_peerconnection_api",
+ ":scoped_refptr",
+ "../pc:peer_connection_factory",
+ "../rtc_base/system:rtc_export",
+ "../stats:rtc_stats",
+ ]
+}
+
if (!build_with_chromium && !build_with_mozilla) {
rtc_library("create_peerconnection_factory") {
visibility = [ "*" ]
@@ -82,14 +95,13 @@ if (!build_with_chromium && !build_with_mozilla) {
"create_peerconnection_factory.h",
]
deps = [
+ ":create_modular_peer_connection_factory",
":enable_media",
":field_trials_view",
":libjingle_peerconnection_api",
":scoped_refptr",
- "../pc:peer_connection_factory",
"../rtc_base:threading",
"../rtc_base/system:rtc_export",
- "../stats:rtc_stats",
"audio:audio_device",
"audio:audio_mixer_api",
"audio:audio_processing",
@@ -304,6 +316,17 @@ rtc_library("rtp_sender_setparameters_callback") {
]
}
+# TODO: bugs.webrtc.org/42220069 - Remove when downstream has been updated
+# to depend on `create_modular_peer_connection_factory` instead.
+rtc_source_set("create_modular_peer_connection_factory_internal") {
+ visibility = [ ":libjingle_peerconnection_api" ]
+ sources = [ "create_modular_peer_connection_factory_internal.h" ]
+ deps = [
+ ":scoped_refptr",
+ "../rtc_base/system:rtc_export",
+ ]
+}
+
rtc_library("libjingle_peerconnection_api") {
if (!build_with_mozilla) {
visibility = [ "*" ]
@@ -345,6 +368,7 @@ if (!build_with_mozilla) {
":async_dns_resolver",
":audio_options_api",
":candidate",
+ ":create_modular_peer_connection_factory_internal",
":data_channel_event_observer_interface",
":dtls_transport_interface",
":fec_controller_api",
diff --git a/third_party/libwebrtc/api/create_modular_peer_connection_factory.h b/third_party/libwebrtc/api/create_modular_peer_connection_factory.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2025 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef API_CREATE_MODULAR_PEER_CONNECTION_FACTORY_H_
+#define API_CREATE_MODULAR_PEER_CONNECTION_FACTORY_H_
+
+#include "api/peer_connection_interface.h"
+#include "api/scoped_refptr.h"
+#include "rtc_base/system/rtc_export.h"
+
+namespace webrtc {
+// Creates a new instance of PeerConnectionFactoryInterface with optional
+// dependencies.
+//
+// If an application knows it will only require certain modules, it can reduce
+// webrtc's impact on its binary size by depending only on this target and the
+// modules the application requires, using CreateModularPeerConnectionFactory.
+// For example, if an application only uses WebRTC for audio, it can pass in
+// null pointers for the video-specific interfaces, and omit the corresponding
+// modules from its build.
+RTC_EXPORT scoped_refptr<PeerConnectionFactoryInterface>
+CreateModularPeerConnectionFactory(
+ PeerConnectionFactoryDependencies dependencies);
+
+} // namespace webrtc
+
+#endif // API_CREATE_MODULAR_PEER_CONNECTION_FACTORY_H_
diff --git a/third_party/libwebrtc/api/create_modular_peer_connection_factory_internal.h b/third_party/libwebrtc/api/create_modular_peer_connection_factory_internal.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2025 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+// This temporary header is here to steer users of the
+// CreateModularPeerConnectionFactory to include
+// `create_modular_peer_connection_factory.h` and thus depend on
+// `create_modular_peer_connection_factory` build target. Once users are
+// migrated this file can be deleted.
+
+// IWYU pragma: private, include "api/create_modular_peer_connection_factory.h"
+
+#ifndef API_CREATE_MODULAR_PEER_CONNECTION_FACTORY_INTERNAL_H_
+#define API_CREATE_MODULAR_PEER_CONNECTION_FACTORY_INTERNAL_H_
+
+#include "api/scoped_refptr.h"
+#include "rtc_base/system/rtc_export.h"
+
+namespace webrtc {
+
+// Forward declare to avoid circular dependencies with
+// `api/peer_connection_interface.h`. This file exists to be included from that
+// header, and same time requires classes defined in that header.
+class PeerConnectionFactoryInterface;
+struct PeerConnectionFactoryDependencies;
+
+RTC_EXPORT scoped_refptr<PeerConnectionFactoryInterface>
+CreateModularPeerConnectionFactory(
+ PeerConnectionFactoryDependencies dependencies);
+
+} // namespace webrtc
+
+#endif // API_CREATE_MODULAR_PEER_CONNECTION_FACTORY_INTERNAL_H_
diff --git a/third_party/libwebrtc/api/create_peerconnection_factory.cc b/third_party/libwebrtc/api/create_peerconnection_factory.cc
@@ -19,6 +19,7 @@
#include "api/audio/builtin_audio_processing_builder.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/audio_encoder_factory.h"
+#include "api/create_modular_peer_connection_factory.h"
#include "api/enable_media.h"
#include "api/environment/environment_factory.h"
#include "api/field_trials_view.h"
diff --git a/third_party/libwebrtc/api/peer_connection_interface.h b/third_party/libwebrtc/api/peer_connection_interface.h
@@ -148,6 +148,10 @@
#include "rtc_base/system/rtc_export.h"
#include "rtc_base/thread.h"
+// TODO: bugs.webrtc.org/42220069 - Remove this include when users of this
+// function include "create_modular_peer_connection_factory.h" instead.
+#include "api/create_modular_peer_connection_factory_internal.h" // IWYU pragma: keep
+
namespace webrtc {
// IWYU pragma: begin_keep
// MediaFactory class definition is not part of the api.
@@ -1594,26 +1598,6 @@ class RTC_EXPORT PeerConnectionFactoryInterface : public RefCountInterface {
~PeerConnectionFactoryInterface() override = default;
};
-// CreateModularPeerConnectionFactory is implemented in the "peerconnection"
-// build target, which doesn't pull in the implementations of every module
-// webrtc may use.
-//
-// If an application knows it will only require certain modules, it can reduce
-// webrtc's impact on its binary size by depending only on the "peerconnection"
-// target and the modules the application requires, using
-// CreateModularPeerConnectionFactory. For example, if an application
-// only uses WebRTC for audio, it can pass in null pointers for the
-// video-specific interfaces, and omit the corresponding modules from its
-// build.
-//
-// If `network_thread` or `worker_thread` are null, the PeerConnectionFactory
-// will create the necessary thread internally. If `signaling_thread` is null,
-// the PeerConnectionFactory will use the thread on which this method is called
-// as the signaling thread, wrapping it in an Thread object if needed.
-RTC_EXPORT scoped_refptr<PeerConnectionFactoryInterface>
-CreateModularPeerConnectionFactory(
- PeerConnectionFactoryDependencies dependencies);
-
// https://w3c.github.io/webrtc-pc/#dom-rtcsignalingstate
inline constexpr absl::string_view PeerConnectionInterface::AsString(
SignalingState state) {
diff --git a/third_party/libwebrtc/moz-patch-stack/p0001.patch b/third_party/libwebrtc/moz-patch-stack/p0001.patch
@@ -75,10 +75,10 @@ index 1565aeb592..fd77e776cd 100644
"api/transport/rtp:corruption_detection_message_unittest",
"api/video/test:rtc_api_video_unittests",
diff --git a/api/BUILD.gn b/api/BUILD.gn
-index 2cd7560d6c..1525c634b2 100644
+index 2dbc1c17ba..4ee76f6757 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
-@@ -888,8 +888,6 @@ rtc_source_set("simulated_network_api") {
+@@ -912,8 +912,6 @@ rtc_source_set("simulated_network_api") {
"../rtc_base:random",
"transport:ecn_marking",
"units:data_rate",
@@ -87,7 +87,7 @@ index 2cd7560d6c..1525c634b2 100644
"//third_party/abseil-cpp/absl/functional:any_invocable",
]
}
-@@ -915,7 +913,6 @@ rtc_library("network_emulation_manager_api") {
+@@ -939,7 +937,6 @@ rtc_library("network_emulation_manager_api") {
"../rtc_base:socket_address",
"../test/network:simulated_network",
"test/network_emulation",
diff --git a/third_party/libwebrtc/moz-patch-stack/s0027.patch b/third_party/libwebrtc/moz-patch-stack/s0027.patch
@@ -203,7 +203,7 @@ index fd77e776cd..9d79e5e129 100644
}
diff --git a/api/BUILD.gn b/api/BUILD.gn
-index 1525c634b2..05a8d4fd17 100644
+index 4ee76f6757..158f567cc5 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -44,6 +44,9 @@ rtc_library("enable_media") {
@@ -216,7 +216,7 @@ index 1525c634b2..05a8d4fd17 100644
}
rtc_library("enable_media_with_defaults") {
-@@ -70,7 +73,7 @@ rtc_library("enable_media_with_defaults") {
+@@ -83,7 +86,7 @@ rtc_source_set("create_modular_peer_connection_factory") {
]
}
@@ -225,7 +225,7 @@ index 1525c634b2..05a8d4fd17 100644
rtc_library("create_peerconnection_factory") {
visibility = [ "*" ]
allow_poison = [ "environment_construction" ]
-@@ -226,6 +229,10 @@ rtc_source_set("ice_transport_interface") {
+@@ -238,6 +241,10 @@ rtc_source_set("ice_transport_interface") {
}
rtc_library("dtls_transport_interface") {
@@ -236,7 +236,7 @@ index 1525c634b2..05a8d4fd17 100644
visibility = [ "*" ]
sources = [
-@@ -242,6 +249,7 @@ rtc_library("dtls_transport_interface") {
+@@ -254,6 +261,7 @@ rtc_library("dtls_transport_interface") {
"//third_party/abseil-cpp/absl/base:core_headers",
]
}
@@ -244,7 +244,7 @@ index 1525c634b2..05a8d4fd17 100644
rtc_library("dtmf_sender_interface") {
visibility = [ "*" ]
-@@ -254,6 +262,10 @@ rtc_library("dtmf_sender_interface") {
+@@ -266,6 +274,10 @@ rtc_library("dtmf_sender_interface") {
}
rtc_library("rtp_sender_interface") {
@@ -255,7 +255,7 @@ index 1525c634b2..05a8d4fd17 100644
visibility = [ "*" ]
sources = [
-@@ -268,6 +280,7 @@ rtc_library("rtp_sender_interface") {
+@@ -280,6 +292,7 @@ rtc_library("rtp_sender_interface") {
":ref_count",
":rtc_error",
":rtp_parameters",
@@ -263,7 +263,7 @@ index 1525c634b2..05a8d4fd17 100644
":scoped_refptr",
"../rtc_base:checks",
"../rtc_base/system:rtc_export",
-@@ -276,8 +289,23 @@ rtc_library("rtp_sender_interface") {
+@@ -288,6 +301,20 @@ rtc_library("rtp_sender_interface") {
"//third_party/abseil-cpp/absl/functional:any_invocable",
]
}
@@ -282,12 +282,17 @@ index 1525c634b2..05a8d4fd17 100644
+ ]
+}
+ # TODO: bugs.webrtc.org/42220069 - Remove when downstream has been updated
+ # to depend on `create_modular_peer_connection_factory` instead.
+@@ -301,6 +328,7 @@ rtc_source_set("create_modular_peer_connection_factory_internal") {
+ }
+
rtc_library("libjingle_peerconnection_api") {
+if (!build_with_mozilla) {
visibility = [ "*" ]
cflags = []
sources = [
-@@ -404,6 +432,7 @@ rtc_library("libjingle_peerconnection_api") {
+@@ -428,6 +456,7 @@ rtc_library("libjingle_peerconnection_api") {
"../rtc_base/system:rtc_export",
]
}
@@ -295,7 +300,7 @@ index 1525c634b2..05a8d4fd17 100644
rtc_library("frame_transformer_interface") {
visibility = [ "*" ]
-@@ -622,6 +651,7 @@ rtc_source_set("peer_network_dependencies") {
+@@ -646,6 +675,7 @@ rtc_source_set("peer_network_dependencies") {
}
rtc_source_set("peer_connection_quality_test_fixture_api") {
@@ -303,7 +308,7 @@ index 1525c634b2..05a8d4fd17 100644
visibility = [ "*" ]
testonly = true
sources = [ "test/peerconnection_quality_test_fixture.h" ]
-@@ -666,6 +696,7 @@ rtc_source_set("peer_connection_quality_test_fixture_api") {
+@@ -690,6 +720,7 @@ rtc_source_set("peer_connection_quality_test_fixture_api") {
"//third_party/abseil-cpp/absl/strings:string_view",
]
}
@@ -311,7 +316,7 @@ index 1525c634b2..05a8d4fd17 100644
rtc_library("frame_generator_api") {
visibility = [ "*" ]
-@@ -771,6 +802,7 @@ rtc_library("create_frame_generator") {
+@@ -795,6 +826,7 @@ rtc_library("create_frame_generator") {
]
}
@@ -319,7 +324,7 @@ index 1525c634b2..05a8d4fd17 100644
rtc_library("create_peer_connection_quality_test_frame_generator") {
visibility = [ "*" ]
testonly = true
-@@ -788,6 +820,7 @@ rtc_library("create_peer_connection_quality_test_frame_generator") {
+@@ -812,6 +844,7 @@ rtc_library("create_peer_connection_quality_test_frame_generator") {
"units:time_delta",
]
}
@@ -327,7 +332,7 @@ index 1525c634b2..05a8d4fd17 100644
rtc_source_set("data_channel_event_observer_interface") {
visibility = [ "*" ]
-@@ -976,6 +1009,7 @@ rtc_source_set("refcountedbase") {
+@@ -1000,6 +1033,7 @@ rtc_source_set("refcountedbase") {
]
}
@@ -335,7 +340,7 @@ index 1525c634b2..05a8d4fd17 100644
rtc_library("ice_transport_factory") {
visibility = [ "*" ]
sources = [
-@@ -1000,6 +1034,7 @@ rtc_library("ice_transport_factory") {
+@@ -1024,6 +1058,7 @@ rtc_library("ice_transport_factory") {
"rtc_event_log:rtc_event_log",
]
}
diff --git a/third_party/libwebrtc/moz-patch-stack/s0103.patch b/third_party/libwebrtc/moz-patch-stack/s0103.patch
@@ -126,7 +126,7 @@ index 74f7c78e12..f5aa3cc9fe 100644
"Generated during 'gn gen' by //BUILD.gn.",
"",
diff --git a/api/BUILD.gn b/api/BUILD.gn
-index 05a8d4fd17..a25df3f4c8 100644
+index 158f567cc5..4d9551d3c8 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -8,8 +8,8 @@
diff --git a/third_party/libwebrtc/pc/peer_connection_factory.cc b/third_party/libwebrtc/pc/peer_connection_factory.cc
@@ -86,6 +86,9 @@ Environment AssembleEnvironment(PeerConnectionFactoryDependencies& deps) {
} // namespace
+// TODO: bugs.webrtc.org/42220069 - Move this function to
+// 'create_modular_peer_connection_factory' build target when all users of this
+// function would depend on that build target.
scoped_refptr<PeerConnectionFactoryInterface>
CreateModularPeerConnectionFactory(
PeerConnectionFactoryDependencies dependencies) {