tor-browser

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

commit 9b907c63b115be80cb54687dcd6f8c8c441fdcba
parent 6bf1b0362d689dc60f361c883567d26d80651844
Author: Dan Baker <dbaker@mozilla.com>
Date:   Thu, 23 Oct 2025 16:44:12 -0600

Bug 1995393 - Vendor libwebrtc from 23eec04cbd

Upstream commit: https://webrtc.googlesource.com/src/+/23eec04cbddc684a17a76ba8e5d5f796beecb089
    Propagate clock into VP8 ScreenshareLayers helper

    Bug: webrtc:42223992
    Change-Id: I025321eafcb6565059820e0a989482c475b7907e
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/404321
    Reviewed-by: Philip Eliasson <philipel@webrtc.org>
    Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
    Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#45363}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/api/video_codecs/BUILD.gn | 1+
Mthird_party/libwebrtc/api/video_codecs/vp8_frame_buffer_controller.h | 2++
Mthird_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory.cc | 4+++-
Mthird_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory.h | 2++
Mthird_party/libwebrtc/modules/video_coding/BUILD.gn | 3++-
Mthird_party/libwebrtc/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc | 2+-
Mthird_party/libwebrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc | 15+++++++++------
Mthird_party/libwebrtc/modules/video_coding/codecs/vp8/screenshare_layers.h | 7+++----
Mthird_party/libwebrtc/modules/video_coding/codecs/vp8/screenshare_layers_unittest.cc | 7+++++--
Mthird_party/libwebrtc/modules/video_coding/video_codec_initializer_unittest.cc | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0018.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0100.patch | 2+-
Mthird_party/libwebrtc/moz-patch-stack/s0102.patch | 4++--
Mthird_party/libwebrtc/test/fake_vp8_encoder.cc | 2+-
Mthird_party/libwebrtc/video/video_stream_encoder_unittest.cc | 2+-
16 files changed, 37 insertions(+), 24 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-23T22:41:43.265601+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T22:44:00.232693+00:00. # base of lastest vendoring -e7f1e2356d +23eec04cbd diff --git a/third_party/libwebrtc/api/video_codecs/BUILD.gn b/third_party/libwebrtc/api/video_codecs/BUILD.gn @@ -437,6 +437,7 @@ rtc_library("vp8_temporal_layers_factory") { "../../modules/video_coding:video_coding_utility", "../../modules/video_coding:webrtc_vp8_temporal_layers", "../../rtc_base:checks", + "../environment", ] } diff --git a/third_party/libwebrtc/api/video_codecs/vp8_frame_buffer_controller.h b/third_party/libwebrtc/api/video_codecs/vp8_frame_buffer_controller.h @@ -18,6 +18,7 @@ #include <optional> #include <vector> +#include "api/environment/environment.h" #include "api/fec_controller_override.h" #include "api/video_codecs/video_codec.h" #include "api/video_codecs/video_encoder.h" @@ -184,6 +185,7 @@ class Vp8FrameBufferControllerFactory { // Create a Vp8FrameBufferController instance. virtual std::unique_ptr<Vp8FrameBufferController> Create( + const Environment& env, const VideoCodec& codec, const VideoEncoder::Settings& settings, FecControllerOverride* fec_controller_override) = 0; diff --git a/third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory.cc b/third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory.cc @@ -15,6 +15,7 @@ #include <utility> #include <vector> +#include "api/environment/environment.h" #include "api/fec_controller_override.h" #include "api/video_codecs/video_codec.h" #include "api/video_codecs/video_encoder.h" @@ -28,6 +29,7 @@ namespace webrtc { std::unique_ptr<Vp8FrameBufferController> Vp8TemporalLayersFactory::Create( + const Environment& env, const VideoCodec& codec, const VideoEncoder::Settings& /* settings */, FecControllerOverride* fec_controller_override) { @@ -44,7 +46,7 @@ std::unique_ptr<Vp8FrameBufferController> Vp8TemporalLayersFactory::Create( // Legacy screenshare layers supports max 2 layers. num_temporal_layers = std::max(2, num_temporal_layers); controllers.push_back( - std::make_unique<ScreenshareLayers>(num_temporal_layers)); + std::make_unique<ScreenshareLayers>(env, num_temporal_layers)); } else { controllers.push_back( std::make_unique<DefaultTemporalLayers>(num_temporal_layers)); diff --git a/third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory.h b/third_party/libwebrtc/api/video_codecs/vp8_temporal_layers_factory.h @@ -13,6 +13,7 @@ #include <memory> +#include "api/environment/environment.h" #include "api/fec_controller_override.h" #include "api/video_codecs/video_codec.h" #include "api/video_codecs/video_encoder.h" @@ -27,6 +28,7 @@ class Vp8TemporalLayersFactory : public Vp8FrameBufferControllerFactory { std::unique_ptr<Vp8FrameBufferControllerFactory> Clone() const override; std::unique_ptr<Vp8FrameBufferController> Create( + const Environment& env, const VideoCodec& codec, const VideoEncoder::Settings& settings, FecControllerOverride* fec_controller_override) override; diff --git a/third_party/libwebrtc/modules/video_coding/BUILD.gn b/third_party/libwebrtc/modules/video_coding/BUILD.gn @@ -659,6 +659,7 @@ rtc_library("webrtc_vp8_temporal_layers") { ":video_codec_interface", ":video_coding_utility", "../../api:fec_controller_api", + "../../api/environment", "../../api/transport/rtp:dependency_descriptor", "../../api/video:video_codec_constants", "../../api/video_codecs:video_codecs_api", @@ -667,7 +668,6 @@ rtc_library("webrtc_vp8_temporal_layers") { "../../rtc_base:logging", "../../rtc_base:rate_statistics", "../../rtc_base:rtc_numerics", - "../../rtc_base:timeutils", "../../system_wrappers:metrics", "//third_party/abseil-cpp/absl/container:inlined_vector", "//third_party/abseil-cpp/absl/strings:string_view", @@ -1339,6 +1339,7 @@ if (rtc_include_tests) { "../../rtc_base/system:unused", "../../system_wrappers", "../../system_wrappers:metrics", + "../../test:create_test_environment", "../../test:create_test_field_trials", "../../test:fake_encoded_frame", "../../test:fake_video_codecs", diff --git a/third_party/libwebrtc/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc b/third_party/libwebrtc/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc @@ -556,7 +556,7 @@ int LibvpxVp8Encoder::InitEncode(const VideoCodec* inst, RTC_DCHECK(!frame_buffer_controller_); Vp8TemporalLayersFactory factory; frame_buffer_controller_ = - factory.Create(*inst, settings, fec_controller_override_); + factory.Create(env_, *inst, settings, fec_controller_override_); RTC_DCHECK(frame_buffer_controller_); number_of_cores_ = settings.number_of_cores; diff --git a/third_party/libwebrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc b/third_party/libwebrtc/modules/video_coding/codecs/vp8/screenshare_layers.cc @@ -16,6 +16,7 @@ #include <optional> #include <vector> +#include "api/environment/environment.h" #include "api/transport/rtp/dependency_descriptor.h" #include "api/video_codecs/video_encoder.h" #include "api/video_codecs/vp8_frame_buffer_controller.h" @@ -27,7 +28,6 @@ #include "modules/video_coding/include/video_codec_interface.h" #include "rtc_base/checks.h" #include "rtc_base/logging.h" -#include "rtc_base/time_utils.h" #include "system_wrappers/include/metrics.h" namespace webrtc { @@ -55,8 +55,10 @@ const double ScreenshareLayers::kAcceptableTargetOvershoot = 2.0; // been exceeded. This prevents needless keyframe requests. const int ScreenshareLayers::kMaxFrameIntervalMs = 2750; -ScreenshareLayers::ScreenshareLayers(int num_temporal_layers) - : number_of_temporal_layers_( +ScreenshareLayers::ScreenshareLayers(const Environment& env, + int num_temporal_layers) + : env_(env), + number_of_temporal_layers_( std::min(kMaxNumTemporalLayers, num_temporal_layers)), active_layer_(-1), last_timestamp_(-1), @@ -125,7 +127,7 @@ Vp8FrameConfig ScreenshareLayers::NextFrameConfig(size_t stream_index, return dependency_info.frame_config; } - const int64_t now_ms = TimeMillis(); + const int64_t now_ms = env_.clock().TimeInMilliseconds(); int64_t unwrapped_timestamp = time_wrap_handler_.Unwrap(timestamp); int64_t ts_diff; @@ -390,7 +392,7 @@ void ScreenshareLayers::OnEncodeDone(size_t stream_index, } } - encode_framerate_.Update(1, TimeMillis()); + encode_framerate_.Update(1, env_.clock().TimeInMilliseconds()); if (number_of_temporal_layers_ == 1) return; @@ -593,7 +595,8 @@ void ScreenshareLayers::UpdateHistograms() { if (stats_.first_frame_time_ms_ == -1) return; int64_t duration_sec = - (TimeMillis() - stats_.first_frame_time_ms_ + 500) / 1000; + (env_.clock().TimeInMilliseconds() - stats_.first_frame_time_ms_ + 500) / + 1000; if (duration_sec >= metrics::kMinRunTime.seconds()) { RTC_HISTOGRAM_COUNTS_10000( "WebRTC.Video.Screenshare.Layer0.FrameRate", diff --git a/third_party/libwebrtc/modules/video_coding/codecs/vp8/screenshare_layers.h b/third_party/libwebrtc/modules/video_coding/codecs/vp8/screenshare_layers.h @@ -18,6 +18,7 @@ #include "absl/container/inlined_vector.h" #include "absl/strings/string_view.h" +#include "api/environment/environment.h" #include "api/transport/rtp/dependency_descriptor.h" #include "api/video_codecs/video_encoder.h" #include "api/video_codecs/vp8_frame_buffer_controller.h" @@ -29,16 +30,13 @@ namespace webrtc { -struct CodecSpecificInfoVP8; -class Clock; - class ScreenshareLayers final : public Vp8FrameBufferController { public: static const double kMaxTL0FpsReduction; static const double kAcceptableTargetOvershoot; static const int kMaxFrameIntervalMs; - explicit ScreenshareLayers(int num_temporal_layers); + ScreenshareLayers(const Environment& env, int num_temporal_layers); ~ScreenshareLayers() override; void SetQpLimits(size_t stream_index, int min_qp, int max_qp) override; @@ -93,6 +91,7 @@ class ScreenshareLayers final : public Vp8FrameBufferController { bool TimeToSync(int64_t timestamp) const; uint32_t GetCodecTargetBitrateKbps() const; + const Environment env_; const int number_of_temporal_layers_; // TODO(eladalon/sprang): These should be made into const-int set in the ctor. diff --git a/third_party/libwebrtc/modules/video_coding/codecs/vp8/screenshare_layers_unittest.cc b/third_party/libwebrtc/modules/video_coding/codecs/vp8/screenshare_layers_unittest.cc @@ -19,6 +19,7 @@ #include <optional> #include <vector> +#include "api/environment/environment.h" #include "api/units/time_delta.h" #include "api/video_codecs/vp8_frame_buffer_controller.h" #include "api/video_codecs/vp8_frame_config.h" @@ -29,6 +30,7 @@ #include "rtc_base/fake_clock.h" #include "rtc_base/time_utils.h" #include "system_wrappers/include/metrics.h" +#include "test/create_test_environment.h" #include "test/gmock.h" #include "test/gtest.h" #include "third_party/libvpx/source/libvpx/vpx/vp8cx.h" @@ -72,7 +74,7 @@ class ScreenshareLayerTest : public ::testing::Test { ~ScreenshareLayerTest() override {} void SetUp() override { - layers_.reset(new ScreenshareLayers(2)); + layers_ = std::make_unique<ScreenshareLayers>(env_, 2); cfg_ = ConfigureBitrates(); } @@ -194,6 +196,7 @@ class ScreenshareLayerTest : public ::testing::Test { return -1; } + const Environment env_ = CreateTestEnvironment(); int min_qp_; uint32_t max_qp_; int frame_size_; @@ -215,7 +218,7 @@ class ScreenshareLayerTest : public ::testing::Test { }; TEST_F(ScreenshareLayerTest, 1Layer) { - layers_.reset(new ScreenshareLayers(1)); + layers_ = std::make_unique<ScreenshareLayers>(env_, 1); ConfigureBitrates(); // One layer screenshare should not use the frame dropper as all frames will // belong to the base layer. diff --git a/third_party/libwebrtc/modules/video_coding/video_codec_initializer_unittest.cc b/third_party/libwebrtc/modules/video_coding/video_codec_initializer_unittest.cc @@ -111,7 +111,7 @@ class VideoCodecInitializerTest : public ::testing::Test { const VideoEncoder::Settings settings(VideoEncoder::Capabilities(false), 1, 1000); frame_buffer_controller_ = - factory.Create(codec_out_, settings, &fec_controller_override_); + factory.Create(env_, codec_out_, settings, &fec_controller_override_); } } diff --git a/third_party/libwebrtc/moz-patch-stack/s0018.patch b/third_party/libwebrtc/moz-patch-stack/s0018.patch @@ -23,7 +23,7 @@ index 5e51c316cc..3578e2651a 100644 #else constexpr bool kIsArm = false; diff --git a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc -index c9925b1875..8a4c1aa2b7 100644 +index f01142e499..35cea1e81a 100644 --- a/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc +++ b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc @@ -794,7 +794,7 @@ int LibvpxVp8Encoder::InitEncode(const VideoCodec* inst, diff --git a/third_party/libwebrtc/moz-patch-stack/s0100.patch b/third_party/libwebrtc/moz-patch-stack/s0100.patch @@ -39,7 +39,7 @@ index 0f2341a462..51d055bcf0 100644 group("media") { diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn -index ef3d60ee34..0d68cb4b29 100644 +index 1cc12a4636..33c4316577 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/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 @@ -261,7 +261,7 @@ index cd74281a22..16af840261 100644 rtc_library("video_rtp_headers") { diff --git a/api/video_codecs/BUILD.gn b/api/video_codecs/BUILD.gn -index eddc2b7782..c767531ecd 100644 +index c6040740ce..70ed476401 100644 --- a/api/video_codecs/BUILD.gn +++ b/api/video_codecs/BUILD.gn @@ -8,8 +8,8 @@ @@ -588,7 +588,7 @@ index a693604389..72972d18e1 100644 import("../../webrtc.gni") diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn -index 0d68cb4b29..43a7a2e8d8 100644 +index 33c4316577..034a8c2cf1 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -6,7 +6,7 @@ diff --git a/third_party/libwebrtc/test/fake_vp8_encoder.cc b/third_party/libwebrtc/test/fake_vp8_encoder.cc @@ -67,7 +67,7 @@ int32_t FakeVp8Encoder::InitEncode(const VideoCodec* config, Vp8TemporalLayersFactory factory; frame_buffer_controller_ = - factory.Create(*config, settings, &fec_controller_override_); + factory.Create(env_, *config, settings, &fec_controller_override_); return WEBRTC_VIDEO_CODEC_OK; } diff --git a/third_party/libwebrtc/video/video_stream_encoder_unittest.cc b/third_party/libwebrtc/video/video_stream_encoder_unittest.cc @@ -1344,7 +1344,7 @@ class VideoStreamEncoderTest : public ::testing::Test { // cycle of these objects. Vp8TemporalLayersFactory factory; frame_buffer_controller_ = - factory.Create(*config, settings, &fec_controller_override_); + factory.Create(env_, *config, settings, &fec_controller_override_); } last_encoder_complexity_ = config->GetVideoEncoderComplexity();