tor-browser

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

commit eec0e8c1f825ca0d669fa0e031ffd4911d324b7a
parent 3fac22a55b89b918b2ecfce576f882b1310dc474
Author: Dan Baker <dbaker@mozilla.com>
Date:   Mon, 27 Oct 2025 12:43:30 -0600

Bug 1995393 - Vendor libwebrtc from 179e05f6ae

Upstream commit: https://webrtc.googlesource.com/src/+/179e05f6ae12d9959156309b75080b953b22a84c
    Use injected clock in LegacyStatsCollector

    Bug: webrtc:42223992
    Change-Id: I83b51e2efbf5131f0d8d53b44f45cbe67500a124
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/406241
    Commit-Queue: Henrik Boström <hbos@webrtc.org>
    Reviewed-by: Henrik Boström <hbos@webrtc.org>
    Auto-Submit: Evan Shrubsole <eshr@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45435}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/moz-patch-stack/s0102.patch | 2+-
Mthird_party/libwebrtc/pc/BUILD.gn | 1+
Mthird_party/libwebrtc/pc/legacy_stats_collector.cc | 7+++++--
Mthird_party/libwebrtc/pc/legacy_stats_collector.h | 4+++-
Mthird_party/libwebrtc/pc/legacy_stats_collector_unittest.cc | 9++++++---
Mthird_party/libwebrtc/pc/peer_connection.cc | 2+-
7 files changed, 19 insertions(+), 10 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-27T18:40:32.986399+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-27T18:43:12.991669+00:00. # base of lastest vendoring -8f2f27ef9c +179e05f6ae diff --git a/third_party/libwebrtc/moz-patch-stack/s0102.patch b/third_party/libwebrtc/moz-patch-stack/s0102.patch @@ -601,7 +601,7 @@ index b7561e53b6..fe7eb57423 100644 import("../../webrtc.gni") diff --git a/pc/BUILD.gn b/pc/BUILD.gn -index 47e5c4d2ca..10fdbd3c1c 100644 +index 94314bbb3d..bfdf444763 100644 --- a/pc/BUILD.gn +++ b/pc/BUILD.gn @@ -30,8 +30,8 @@ diff --git a/third_party/libwebrtc/pc/BUILD.gn b/third_party/libwebrtc/pc/BUILD.gn @@ -1375,6 +1375,7 @@ rtc_library("legacy_stats_collector") { "../rtc_base:stringutils", "../rtc_base:threading", "../rtc_base:timeutils", + "../system_wrappers", "//third_party/abseil-cpp/absl/strings", "//third_party/abseil-cpp/absl/strings:string_view", ] diff --git a/third_party/libwebrtc/pc/legacy_stats_collector.cc b/third_party/libwebrtc/pc/legacy_stats_collector.cc @@ -63,6 +63,7 @@ #include "rtc_base/thread.h" #include "rtc_base/time_utils.h" #include "rtc_base/trace_event.h" +#include "system_wrappers/include/clock.h" namespace webrtc { namespace { @@ -554,8 +555,10 @@ const char* AdapterTypeToStatsType(AdapterType type) { } } -LegacyStatsCollector::LegacyStatsCollector(PeerConnectionInternal* pc) +LegacyStatsCollector::LegacyStatsCollector(PeerConnectionInternal* pc, + Clock& clock) : pc_(pc), + clock_(clock), stats_gathering_started_(0), use_standard_bytes_stats_( pc->trials().IsEnabled(kUseStandardBytesStats)) { @@ -677,7 +680,7 @@ void LegacyStatsCollector::UpdateStats( // will be ignored. Using a monotonic clock specifically for this, while using // a UTC clock for the reports themselves. const int64_t kMinGatherStatsPeriodMs = 50; - int64_t cache_now_ms = TimeMillis(); + int64_t cache_now_ms = clock_.TimeInMilliseconds(); if (cache_timestamp_ms_ != 0 && cache_timestamp_ms_ + kMinGatherStatsPeriodMs > cache_now_ms) { return; diff --git a/third_party/libwebrtc/pc/legacy_stats_collector.h b/third_party/libwebrtc/pc/legacy_stats_collector.h @@ -38,6 +38,7 @@ #include "rtc_base/network_constants.h" #include "rtc_base/ssl_certificate.h" #include "rtc_base/thread_annotations.h" +#include "system_wrappers/include/clock.h" namespace webrtc { @@ -57,7 +58,7 @@ class LegacyStatsCollector : public LegacyStatsCollectorInterface { public: // The caller is responsible for ensuring that the pc outlives the // LegacyStatsCollector instance. - explicit LegacyStatsCollector(PeerConnectionInternal* pc); + LegacyStatsCollector(PeerConnectionInternal* pc, Clock& clock); virtual ~LegacyStatsCollector(); // Adds a MediaStream with tracks that can be used as a `selector` in a call @@ -199,6 +200,7 @@ class LegacyStatsCollector : public LegacyStatsCollectorInterface { TrackIdMap track_ids_; // Raw pointer to the peer connection the statistics are gathered from. PeerConnectionInternal* const pc_; + Clock& clock_; int64_t cache_timestamp_ms_ RTC_GUARDED_BY(pc_->signaling_thread()) = 0; double stats_gathering_started_; const bool use_standard_bytes_stats_; diff --git a/third_party/libwebrtc/pc/legacy_stats_collector_unittest.cc b/third_party/libwebrtc/pc/legacy_stats_collector_unittest.cc @@ -32,6 +32,7 @@ #include "api/peer_connection_interface.h" #include "api/rtp_sender_interface.h" #include "api/scoped_refptr.h" +#include "api/units/timestamp.h" #include "call/call.h" #include "media/base/media_channel.h" #include "p2p/base/connection_info.h" @@ -57,6 +58,7 @@ #include "rtc_base/ssl_identity.h" #include "rtc_base/ssl_stream_adapter.h" #include "rtc_base/thread.h" +#include "system_wrappers/include/clock.h" #include "test/gmock.h" #include "test/gtest.h" @@ -580,8 +582,8 @@ void InitVoiceReceiverInfo(VoiceReceiverInfo* voice_receiver_info) { class LegacyStatsCollectorForTest : public LegacyStatsCollector { public: - explicit LegacyStatsCollectorForTest(PeerConnectionInternal* pc) - : LegacyStatsCollector(pc), time_now_(19477) {} + explicit LegacyStatsCollectorForTest(PeerConnectionInternal* pc, Clock& clock) + : LegacyStatsCollector(pc, clock), time_now_(19477) {} double GetTimeNow() override { return time_now_; } @@ -597,7 +599,7 @@ class LegacyStatsCollectorTest : public ::testing::Test { std::unique_ptr<LegacyStatsCollectorForTest> CreateStatsCollector( PeerConnectionInternal* pc) { - return std::make_unique<LegacyStatsCollectorForTest>(pc); + return std::make_unique<LegacyStatsCollectorForTest>(pc, clock_); } void VerifyAudioTrackStats(FakeAudioTrack* audio_track, @@ -723,6 +725,7 @@ class LegacyStatsCollectorTest : public ::testing::Test { } private: + SimulatedClock clock_{Timestamp::Millis(1337)}; AutoThread main_thread_; }; diff --git a/third_party/libwebrtc/pc/peer_connection.cc b/third_party/libwebrtc/pc/peer_connection.cc @@ -539,7 +539,7 @@ PeerConnection::PeerConnection( /*alive=*/call_ != nullptr, worker_thread())), call_ptr_(call_.get()), - legacy_stats_(std::make_unique<LegacyStatsCollector>(this)), + legacy_stats_(std::make_unique<LegacyStatsCollector>(this, env_.clock())), stats_collector_(RTCStatsCollector::Create(this, env_)), // RFC 3264: The numeric value of the session id and version in the // o line MUST be representable with a "64 bit signed integer".