tor-browser

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

commit ffcbd73919a36cdac2785e8d8788721a6362f555
parent 9af4542c51c17a45177945ec1275e42f129115dc
Author: Dan Baker <dbaker@mozilla.com>
Date:   Mon, 27 Oct 2025 11:49:02 -0600

Bug 1995393 - Vendor libwebrtc from 0f8a007f6e

Upstream commit: https://webrtc.googlesource.com/src/+/0f8a007f6eb34da52d2b3742b6042342588bc4e8
    Use injected clock in webrtc_video_engine

    Stops using the global clock methods from time_utils.

    This CL was uploaded by an experimental version of git cl split
    (https://crbug.com/389069356).

    Bug: webrtc:42223992
    Change-Id: I3781123c078e244b7940ada819dd2bc93c0466fa
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/405522
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
    Commit-Queue: Harald Alvestrand <hta@webrtc.org>
    Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45417}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/media/BUILD.gn | 1+
Mthird_party/libwebrtc/media/engine/webrtc_video_engine.cc | 19+++++++++++--------
Mthird_party/libwebrtc/media/engine/webrtc_video_engine.h | 3++-
Mthird_party/libwebrtc/moz-patch-stack/s0027.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0087.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0100.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0102.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0107.patch | 4++--
Mthird_party/libwebrtc/moz-patch-stack/s0109.patch | 2+-
10 files changed, 23 insertions(+), 18 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-27T17:46:20.043221+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-27T17:48:46.720030+00:00. # base of lastest vendoring -e36d911cce +0f8a007f6e diff --git a/third_party/libwebrtc/media/BUILD.gn b/third_party/libwebrtc/media/BUILD.gn @@ -684,6 +684,7 @@ rtc_library("rtc_audio_video") { "../rtc_base/synchronization:mutex", "../rtc_base/system:file_wrapper", "../rtc_base/system:no_unique_address", + "../system_wrappers", "../system_wrappers:metrics", "../video/config:encoder_config", "//third_party/abseil-cpp/absl/algorithm", diff --git a/third_party/libwebrtc/media/engine/webrtc_video_engine.cc b/third_party/libwebrtc/media/engine/webrtc_video_engine.cc @@ -1609,7 +1609,7 @@ bool WebRtcVideoSendChannel::GetStats(VideoMediaSendInfo* info) { // Log stats periodically. bool log_stats = false; - int64_t now_ms = TimeMillis(); + int64_t now_ms = call_->env().clock().TimeInMilliseconds(); if (last_send_stats_log_ms_ == -1 || now_ms - last_send_stats_log_ms_ > kStatsLogIntervalMs) { last_send_stats_log_ms_ = now_ms; @@ -1785,6 +1785,7 @@ WebRtcVideoSendChannel::WebRtcVideoSendStream::WebRtcVideoSendStream( ssrcs_(sp.ssrcs), ssrc_groups_(sp.ssrc_groups), call_(call), + clock_(&call_->env().clock()), enable_cpu_overuse_detection_(enable_cpu_overuse_detection), source_(nullptr), stream_(nullptr), @@ -2426,7 +2427,7 @@ WebRtcVideoSendChannel::WebRtcVideoSendStream::GetPerLayerVideoSenderInfos( } else { stats = stream_->GetStats(); if (log_stats) - RTC_LOG(LS_INFO) << stats.ToString(TimeMillis()); + RTC_LOG(LS_INFO) << stats.ToString(clock_->TimeInMilliseconds()); // Metrics that are in common for all substreams. common_info.adapt_changes = stats.number_of_cpu_adapt_changes; @@ -3173,7 +3174,7 @@ bool WebRtcVideoReceiveChannel::GetStats(VideoMediaReceiveInfo* info) { // Log stats periodically. bool log_stats = false; - int64_t now_ms = TimeMillis(); + int64_t now_ms = call_->env().clock().TimeInMilliseconds(); if (last_receive_stats_log_ms_ == -1 || now_ms - last_receive_stats_log_ms_ > kStatsLogIntervalMs) { last_receive_stats_log_ms_ = now_ms; @@ -3284,7 +3285,7 @@ bool WebRtcVideoReceiveChannel::MaybeCreateDefaultReceiveStream( // of creating decoders on every packet eats up processing time (e.g. // https://crbug.com/1069603) and this cooldown prevents that. if (last_unsignalled_ssrc_creation_time_ms_.has_value()) { - int64_t now_ms = TimeMillis(); + int64_t now_ms = call_->env().clock().TimeInMilliseconds(); if (now_ms - last_unsignalled_ssrc_creation_time_ms_.value() < kUnsignaledSsrcCooldownMs) { // We've already created an unsignalled ssrc stream within the last @@ -3298,7 +3299,8 @@ bool WebRtcVideoReceiveChannel::MaybeCreateDefaultReceiveStream( // RTX SSRC not yet known. ReCreateDefaultReceiveStream(packet.Ssrc(), std::nullopt); - last_unsignalled_ssrc_creation_time_ms_ = TimeMillis(); + last_unsignalled_ssrc_creation_time_ms_ = + call_->env().clock().TimeInMilliseconds(); return true; } @@ -3724,7 +3726,7 @@ void WebRtcVideoReceiveChannel::WebRtcVideoReceiveStream::OnFrame( const VideoFrame& frame) { MutexLock lock(&sink_lock_); - int64_t time_now_ms = TimeMillis(); + int64_t time_now_ms = call_->env().clock().TimeInMilliseconds(); if (first_frame_timestamp_ < 0) first_frame_timestamp_ = time_now_ms; int64_t elapsed_time_ms = time_now_ms - first_frame_timestamp_; @@ -3914,7 +3916,8 @@ WebRtcVideoReceiveChannel::WebRtcVideoReceiveStream::GetVideoReceiverInfo( // present if DLRR is enabled. if (log_stats) - RTC_LOG(LS_INFO) << stats.ToString(TimeMillis()); + RTC_LOG(LS_INFO) << stats.ToString( + call_->env().clock().TimeInMilliseconds()); return info; } @@ -4006,7 +4009,7 @@ void WebRtcVideoReceiveChannel::ProcessReceivedPacket( packet.IdentifyExtensions(recv_rtp_extension_map_); packet.set_payload_type_frequency(kVideoPayloadTypeFrequency); if (!packet.arrival_time().IsFinite()) { - packet.set_arrival_time(Timestamp::Micros(TimeMicros())); + packet.set_arrival_time(call_->env().clock().CurrentTime()); } call_->Receiver()->DeliverRtpPacket( diff --git a/third_party/libwebrtc/media/engine/webrtc_video_engine.h b/third_party/libwebrtc/media/engine/webrtc_video_engine.h @@ -68,6 +68,7 @@ #include "rtc_base/synchronization/mutex.h" #include "rtc_base/system/no_unique_address.h" #include "rtc_base/thread_annotations.h" +#include "system_wrappers/include/clock.h" #include "video/config/video_encoder_config.h" namespace webrtc { @@ -396,6 +397,7 @@ class WebRtcVideoSendChannel : public MediaChannelUtil, const std::vector<uint32_t> ssrcs_ RTC_GUARDED_BY(&thread_checker_); const std::vector<SsrcGroup> ssrc_groups_ RTC_GUARDED_BY(&thread_checker_); Call* const call_; + Clock* const clock_; const bool enable_cpu_overuse_detection_; VideoSourceInterface<VideoFrame>* source_ RTC_GUARDED_BY(&thread_checker_); @@ -861,5 +863,4 @@ class WebRtcVideoChannel : public WebRtcVideoSendChannel { } // namespace webrtc - #endif // MEDIA_ENGINE_WEBRTC_VIDEO_ENGINE_H_ diff --git a/third_party/libwebrtc/moz-patch-stack/s0027.patch b/third_party/libwebrtc/moz-patch-stack/s0027.patch @@ -549,7 +549,7 @@ index 88890be798..c9aefc297b 100644 #include "rtc_base/memory/aligned_malloc.h" diff --git a/media/BUILD.gn b/media/BUILD.gn -index 4bfd8b4be8..da1a893214 100644 +index e2ac486036..f1da17d4fc 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -77,7 +77,7 @@ rtc_library("rtc_media_base") { diff --git a/third_party/libwebrtc/moz-patch-stack/s0087.patch b/third_party/libwebrtc/moz-patch-stack/s0087.patch @@ -9,7 +9,7 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/60304c5d8a86fdecf 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/media/BUILD.gn b/media/BUILD.gn -index da1a893214..0f2341a462 100644 +index f1da17d4fc..53d8f777c7 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -56,6 +56,11 @@ rtc_library("rtc_media_base") { diff --git a/third_party/libwebrtc/moz-patch-stack/s0100.patch b/third_party/libwebrtc/moz-patch-stack/s0100.patch @@ -26,7 +26,7 @@ index 26080d9abc..4df8681a9b 100644 # These are the targets to skip header checking by default. The files in targets # matching these patterns (see "gn help label_pattern" for format) will not have diff --git a/media/BUILD.gn b/media/BUILD.gn -index 0f2341a462..51d055bcf0 100644 +index 53d8f777c7..33d14980ea 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -7,7 +7,7 @@ diff --git a/third_party/libwebrtc/moz-patch-stack/s0102.patch b/third_party/libwebrtc/moz-patch-stack/s0102.patch @@ -427,7 +427,7 @@ index 401dca948a..cadd4bab1b 100644 group("logging") { diff --git a/media/BUILD.gn b/media/BUILD.gn -index 51d055bcf0..e50b924806 100644 +index 33d14980ea..12c65b29f3 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -6,7 +6,7 @@ diff --git a/third_party/libwebrtc/moz-patch-stack/s0107.patch b/third_party/libwebrtc/moz-patch-stack/s0107.patch @@ -38,7 +38,7 @@ index 6bfae033a3..2a6c14f35b 100644 ] # Added when we removed deps in other places to avoid building diff --git a/media/BUILD.gn b/media/BUILD.gn -index e50b924806..ac722ddda3 100644 +index 12c65b29f3..22057def53 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -12,12 +12,10 @@ import("../webrtc.gni") @@ -102,7 +102,7 @@ index e50b924806..ac722ddda3 100644 rtc_library("rtc_simulcast_encoder_adapter") { visibility = [ "*" ] -@@ -717,6 +715,12 @@ rtc_library("rtc_audio_video") { +@@ -718,6 +716,12 @@ rtc_library("rtc_audio_video") { "engine/webrtc_voice_engine.cc", "engine/webrtc_voice_engine.h", ] diff --git a/third_party/libwebrtc/moz-patch-stack/s0109.patch b/third_party/libwebrtc/moz-patch-stack/s0109.patch @@ -10,7 +10,7 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/b6dd815fc9d2df718 1 file changed, 11 deletions(-) diff --git a/media/BUILD.gn b/media/BUILD.gn -index ac722ddda3..31df4610c7 100644 +index 22057def53..f970d910d3 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -54,11 +54,6 @@ rtc_library("rtc_media_base") {