commit 0c7cf0f7f992bdee9e6399658a16cb7877b6edb3
parent 538cafc9ee357d3cb67e424b4ca18e993f41da92
Author: Michael Froman <mfroman@mozilla.com>
Date: Thu, 9 Oct 2025 23:10:34 -0500
Bug 1993083 - Vendor libwebrtc from e50bbc0fc3
Upstream commit: https://webrtc.googlesource.com/src/+/e50bbc0fc3ebff336477ccb930cd10cbb0c236aa
Cleanup usage of kNumNanosecsPerSec like constants in event.cc
Instead rely on TimeDelta constexpr functions to do conversion between
different units of time.
Bug: webrtc:42223979
Change-Id: I7476a2e344303b907a9e297d42bb8fb396fd3aaa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/401680
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45202}
Diffstat:
10 files changed, 43 insertions(+), 50 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:09:03.110045+00:00.
+libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-10T04:10:24.946620+00:00.
# base of lastest vendoring
-61f0f4c83c
+e50bbc0fc3
diff --git a/third_party/libwebrtc/moz-patch-stack/s0001.patch b/third_party/libwebrtc/moz-patch-stack/s0001.patch
@@ -1383,10 +1383,10 @@ index d5ce6105a3..8bfd24de2b 100644
const bool enable_svc_for_simulcast_;
std::optional<SimulcastToSvcConverter> simulcast_to_svc_converter_;
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
-index fc3180f82b..8dd7e93651 100644
+index fdf70e2756..9e5dfe3c6e 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
-@@ -450,6 +450,12 @@ rtc_library("logging") {
+@@ -449,6 +449,12 @@ rtc_library("logging") {
"//third_party/abseil-cpp/absl/strings:string_view",
]
diff --git a/third_party/libwebrtc/moz-patch-stack/s0027.patch b/third_party/libwebrtc/moz-patch-stack/s0027.patch
@@ -1014,7 +1014,7 @@ index 39aa39a41c..b26e30e8bb 100644
"/config/external/nspr",
"/nsprpub/lib/ds",
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
-index 8dd7e93651..2cc45cee06 100644
+index 9e5dfe3c6e..3bd324c4e1 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -326,6 +326,7 @@ rtc_library("sample_counter") {
@@ -1033,7 +1033,7 @@ index 8dd7e93651..2cc45cee06 100644
rtc_library("zero_memory") {
visibility = [ "*" ]
-@@ -805,7 +807,9 @@ rtc_library("rtc_json") {
+@@ -804,7 +806,9 @@ rtc_library("rtc_json") {
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/strings:string_view",
]
@@ -1043,7 +1043,7 @@ index 8dd7e93651..2cc45cee06 100644
if (rtc_build_json) {
deps += [ "//third_party/jsoncpp" ]
} else {
-@@ -1179,6 +1183,7 @@ if (!build_with_chromium) {
+@@ -1178,6 +1182,7 @@ if (!build_with_chromium) {
}
rtc_library("network") {
@@ -1051,7 +1051,7 @@ index 8dd7e93651..2cc45cee06 100644
visibility = [ "*" ]
sources = [
"network.cc",
-@@ -1220,16 +1225,20 @@ rtc_library("network") {
+@@ -1219,16 +1224,20 @@ rtc_library("network") {
deps += [ ":win32" ]
}
}
@@ -1072,7 +1072,7 @@ index 8dd7e93651..2cc45cee06 100644
visibility = [ "*" ]
sources = [
"net_helper.cc",
-@@ -1240,8 +1249,10 @@ rtc_library("net_helper") {
+@@ -1239,8 +1248,10 @@ rtc_library("net_helper") {
"//third_party/abseil-cpp/absl/strings:string_view",
]
}
@@ -1083,7 +1083,7 @@ index 8dd7e93651..2cc45cee06 100644
visibility = [ "*" ]
sources = [
"socket_adapters.cc",
-@@ -1262,6 +1273,7 @@ rtc_library("socket_adapters") {
+@@ -1261,6 +1272,7 @@ rtc_library("socket_adapters") {
"//third_party/abseil-cpp/absl/strings:string_view",
]
}
@@ -1091,7 +1091,7 @@ index 8dd7e93651..2cc45cee06 100644
rtc_library("network_route") {
sources = [
-@@ -1276,6 +1288,7 @@ rtc_library("network_route") {
+@@ -1275,6 +1287,7 @@ rtc_library("network_route") {
}
rtc_library("async_tcp_socket") {
@@ -1099,7 +1099,7 @@ index 8dd7e93651..2cc45cee06 100644
sources = [
"async_tcp_socket.cc",
"async_tcp_socket.h",
-@@ -1295,8 +1308,10 @@ rtc_library("async_tcp_socket") {
+@@ -1294,8 +1307,10 @@ rtc_library("async_tcp_socket") {
"network:sent_packet",
]
}
@@ -1110,7 +1110,7 @@ index 8dd7e93651..2cc45cee06 100644
visibility = [ "*" ]
sources = [
"async_udp_socket.cc",
-@@ -1320,8 +1335,10 @@ rtc_library("async_udp_socket") {
+@@ -1319,8 +1334,10 @@ rtc_library("async_udp_socket") {
"system:no_unique_address",
]
}
@@ -1121,7 +1121,7 @@ index 8dd7e93651..2cc45cee06 100644
visibility = [ "*" ]
sources = [
"async_packet_socket.cc",
-@@ -1344,6 +1361,7 @@ rtc_library("async_packet_socket") {
+@@ -1343,6 +1360,7 @@ rtc_library("async_packet_socket") {
"//third_party/abseil-cpp/absl/functional:any_invocable",
]
}
@@ -1129,7 +1129,7 @@ index 8dd7e93651..2cc45cee06 100644
if (rtc_include_tests) {
rtc_library("async_packet_socket_unittest") {
-@@ -1429,6 +1447,7 @@ rtc_library("data_rate_limiter") {
+@@ -1428,6 +1446,7 @@ rtc_library("data_rate_limiter") {
}
rtc_library("unique_id_generator") {
@@ -1137,7 +1137,7 @@ index 8dd7e93651..2cc45cee06 100644
sources = [
"unique_id_generator.cc",
"unique_id_generator.h",
-@@ -1446,6 +1465,7 @@ rtc_library("unique_id_generator") {
+@@ -1445,6 +1464,7 @@ rtc_library("unique_id_generator") {
"//third_party/abseil-cpp/absl/strings:string_view",
]
}
@@ -1145,7 +1145,7 @@ index 8dd7e93651..2cc45cee06 100644
rtc_library("crc32") {
sources = [
-@@ -1477,6 +1497,7 @@ rtc_library("stream") {
+@@ -1476,6 +1496,7 @@ rtc_library("stream") {
}
rtc_library("rtc_certificate_generator") {
@@ -1153,7 +1153,7 @@ index 8dd7e93651..2cc45cee06 100644
visibility = [ "*" ]
sources = [
"rtc_certificate_generator.cc",
-@@ -1491,6 +1512,7 @@ rtc_library("rtc_certificate_generator") {
+@@ -1490,6 +1511,7 @@ rtc_library("rtc_certificate_generator") {
"//third_party/abseil-cpp/absl/functional:any_invocable",
]
}
@@ -1161,7 +1161,7 @@ index 8dd7e93651..2cc45cee06 100644
rtc_source_set("ssl_header") {
visibility = [ "*" ]
-@@ -1547,6 +1569,7 @@ rtc_library("crypto_random") {
+@@ -1546,6 +1568,7 @@ rtc_library("crypto_random") {
}
rtc_library("ssl") {
@@ -1169,7 +1169,7 @@ index 8dd7e93651..2cc45cee06 100644
visibility = [ "*" ]
sources = [
"openssl_key_pair.cc",
-@@ -1619,6 +1642,7 @@ rtc_library("ssl") {
+@@ -1618,6 +1641,7 @@ rtc_library("ssl") {
deps += [ ":win32" ]
}
}
@@ -1177,7 +1177,7 @@ index 8dd7e93651..2cc45cee06 100644
rtc_library("ssl_adapter") {
visibility = [ "*" ]
-@@ -2342,7 +2366,7 @@ if (rtc_include_tests) {
+@@ -2341,7 +2365,7 @@ if (rtc_include_tests) {
}
}
diff --git a/third_party/libwebrtc/moz-patch-stack/s0053.patch b/third_party/libwebrtc/moz-patch-stack/s0053.patch
@@ -29,10 +29,10 @@ index 7db75d5fd3..d0feb5007c 100644
rtc_library("task_queue_test") {
visibility = [ "*" ]
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
-index 2cc45cee06..32fc15b51d 100644
+index 3bd324c4e1..9339714ac5 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
-@@ -665,10 +665,14 @@ if (is_mac || is_ios) {
+@@ -664,10 +664,14 @@ if (is_mac || is_ios) {
if (is_win) {
rtc_library("rtc_task_queue_win") {
visibility = [ "../api/task_queue:default_task_queue_factory" ]
diff --git a/third_party/libwebrtc/moz-patch-stack/s0091.patch b/third_party/libwebrtc/moz-patch-stack/s0091.patch
@@ -13,10 +13,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/4e7b3c485e549e7e3
1 file changed, 6 insertions(+)
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
-index 32fc15b51d..520e69d413 100644
+index 9339714ac5..f04d511cd3 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
-@@ -992,6 +992,12 @@ rtc_library("threading") {
+@@ -991,6 +991,12 @@ rtc_library("threading") {
"thread.cc",
"thread.h",
]
diff --git a/third_party/libwebrtc/moz-patch-stack/s0094.patch b/third_party/libwebrtc/moz-patch-stack/s0094.patch
@@ -9,10 +9,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/ee2f06666bcc6d22c
1 file changed, 2 insertions(+)
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
-index 520e69d413..dfdcef1096 100644
+index f04d511cd3..73191dbadd 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
-@@ -1655,6 +1655,7 @@ if (!build_with_mozilla) {
+@@ -1654,6 +1654,7 @@ if (!build_with_mozilla) {
}
rtc_library("ssl_adapter") {
@@ -20,7 +20,7 @@ index 520e69d413..dfdcef1096 100644
visibility = [ "*" ]
sources = [
"openssl_adapter.cc",
-@@ -1703,6 +1704,7 @@ rtc_library("ssl_adapter") {
+@@ -1702,6 +1703,7 @@ rtc_library("ssl_adapter") {
configs += [ "..:external_ssl_library" ]
}
}
diff --git a/third_party/libwebrtc/moz-patch-stack/s0103.patch b/third_party/libwebrtc/moz-patch-stack/s0103.patch
@@ -616,7 +616,7 @@ index 5c8e21b516..7e8ac39126 100644
if (rtc_build_libsrtp) {
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
-index dfdcef1096..fa479fa1ce 100644
+index 73191dbadd..80e93e96ac 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -9,8 +9,8 @@
@@ -630,7 +630,7 @@ index dfdcef1096..fa479fa1ce 100644
}
rtc_source_set("protobuf_utils") {
-@@ -1895,8 +1895,8 @@ if (!rtc_rusty_base64) {
+@@ -1894,8 +1894,8 @@ if (!rtc_rusty_base64) {
]
}
} else {
diff --git a/third_party/libwebrtc/moz-patch-stack/s0108.patch b/third_party/libwebrtc/moz-patch-stack/s0108.patch
@@ -116,10 +116,10 @@ index b58cb6ba9a..4299453d22 100644
public_configs = []
if (!build_with_chromium) {
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
-index fa479fa1ce..98f0b3ddbc 100644
+index 80e93e96ac..daed1b405e 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
-@@ -1534,6 +1534,7 @@ rtc_source_set("ssl_header") {
+@@ -1533,6 +1533,7 @@ rtc_source_set("ssl_header") {
}
rtc_library("digest") {
@@ -127,7 +127,7 @@ index fa479fa1ce..98f0b3ddbc 100644
visibility = [ "*" ]
sources = [
"message_digest.cc",
-@@ -1555,8 +1556,10 @@ rtc_library("digest") {
+@@ -1554,8 +1555,10 @@ rtc_library("digest") {
configs += [ "..:external_ssl_library" ]
}
}
@@ -138,7 +138,7 @@ index fa479fa1ce..98f0b3ddbc 100644
visibility = [ "*" ]
sources = [
"crypto_random.cc",
-@@ -1577,6 +1580,7 @@ rtc_library("crypto_random") {
+@@ -1576,6 +1579,7 @@ rtc_library("crypto_random") {
configs += [ "..:external_ssl_library" ]
}
}
diff --git a/third_party/libwebrtc/rtc_base/BUILD.gn b/third_party/libwebrtc/rtc_base/BUILD.gn
@@ -423,7 +423,6 @@ rtc_library("rtc_event") {
]
deps = [
":checks",
- ":timeutils",
"../api/units:time_delta",
"synchronization:yield_policy",
"system:warn_current_thread_is_deadlocked",
diff --git a/third_party/libwebrtc/rtc_base/event.cc b/third_party/libwebrtc/rtc_base/event.cc
@@ -12,14 +12,13 @@
#include <time.h>
-#include <cstdint>
+#include <cstdlib>
#include <optional>
#include "api/units/time_delta.h"
#include "rtc_base/checks.h"
#include "rtc_base/synchronization/yield_policy.h"
#include "rtc_base/system/warn_current_thread_is_deadlocked.h"
-#include "rtc_base/time_utils.h"
#if defined(WEBRTC_WIN)
#include <windows.h>
@@ -119,7 +118,7 @@ void Event::Reset() {
namespace {
-timespec GetTimespec(TimeDelta duration_from_now) {
+timespec GetTimespec(TimeDelta from_now) {
timespec ts;
// Get the current time.
@@ -129,20 +128,15 @@ timespec GetTimespec(TimeDelta duration_from_now) {
timeval tv;
gettimeofday(&tv, nullptr);
ts.tv_sec = tv.tv_sec;
- ts.tv_nsec = tv.tv_usec * kNumNanosecsPerMicrosec;
+ ts.tv_nsec = TimeDelta::Micros(tv.tv_usec).ns();
#endif
- // Add the specified number of milliseconds to it.
- int64_t microsecs_from_now = duration_from_now.us();
- ts.tv_sec += microsecs_from_now / kNumMicrosecsPerSec;
- ts.tv_nsec +=
- (microsecs_from_now % kNumMicrosecsPerSec) * kNumNanosecsPerMicrosec;
-
- // Normalize.
- if (ts.tv_nsec >= kNumNanosecsPerSec) {
- ts.tv_sec++;
- ts.tv_nsec -= kNumNanosecsPerSec;
- }
+ // Add the specified number of nanoseconds to it.
+ // Use integer division to transfer full seconds to `tv_sec`.
+ // `ns` has type either std::ldiv_t or std::lldiv_t.
+ auto ns = std::div(ts.tv_nsec + from_now.ns(), TimeDelta::Seconds(1).ns());
+ ts.tv_sec += ns.quot;
+ ts.tv_nsec = ns.rem;
return ts;
}