commit 226e06fa2a0c1fc5abfff6c52c33353bc3a67e14
parent 5b00db3eb1f2f1a6fcc945c135b99d7d9c11a908
Author: Dan Baker <dbaker@mozilla.com>
Date: Thu, 20 Nov 2025 13:40:53 -0700
Bug 2000941 - Vendor libwebrtc from 8d31c4add2
Upstream commit: https://webrtc.googlesource.com/src/+/8d31c4add2eb4685afff353a35b705b089d5f21f
Use Clock in desktop_capturer_differ_wrapper_unittest
Bug: webrtc:42223992
Change-Id: I546c67b6c968c410a9fd14cdee29141b1e3227d1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/407805
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45558}
Diffstat:
9 files changed, 52 insertions(+), 37 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-11-20T20:38:14.597377+00:00.
+libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-11-20T20:40:38.325149+00:00.
# base of lastest vendoring
-d7169bf89f
+8d31c4add2
diff --git a/third_party/libwebrtc/modules/desktop_capture/BUILD.gn b/third_party/libwebrtc/modules/desktop_capture/BUILD.gn
@@ -158,12 +158,15 @@ if (rtc_include_tests) {
":desktop_capture_mock",
":primitives",
"../../api:array_view",
+ "../../api/units:time_delta",
+ "../../api/units:timestamp",
"../../rtc_base:checks",
"../../rtc_base:logging",
"../../rtc_base:random",
"../../rtc_base:task_queue_for_test",
"../../rtc_base:threading",
"../../rtc_base:timeutils",
+ "../../system_wrappers",
"../../test:test_support",
]
diff --git a/third_party/libwebrtc/modules/desktop_capture/desktop_capturer_differ_wrapper_unittest.cc b/third_party/libwebrtc/modules/desktop_capture/desktop_capturer_differ_wrapper_unittest.cc
@@ -10,12 +10,13 @@
#include "modules/desktop_capture/desktop_capturer_differ_wrapper.h"
-#include <cstdint>
#include <initializer_list>
#include <memory>
#include <utility>
#include <vector>
+#include "api/units/time_delta.h"
+#include "api/units/timestamp.h"
#include "modules/desktop_capture/desktop_capturer.h"
#include "modules/desktop_capture/desktop_frame.h"
#include "modules/desktop_capture/desktop_frame_generator.h"
@@ -25,7 +26,7 @@
#include "modules/desktop_capture/fake_desktop_capturer.h"
#include "modules/desktop_capture/mock_desktop_capturer_callback.h"
#include "rtc_base/random.h"
-#include "rtc_base/time_utils.h"
+#include "system_wrappers/include/clock.h"
#include "test/gmock.h"
#include "test/gtest.h"
@@ -154,7 +155,8 @@ void ExecuteCapturer(DesktopCapturerDifferWrapper* capturer,
capturer->CaptureFrame();
}
-void ExecuteDifferWrapperTest(bool with_hints,
+void ExecuteDifferWrapperTest(Clock* clock,
+ bool with_hints,
bool enlarge_updated_region,
bool random_updated_region,
bool check_result) {
@@ -203,7 +205,7 @@ void ExecuteDifferWrapperTest(bool with_hints,
frame_generator.size()->height())},
check_result, updated_region_should_exactly_match);
- Random random(TimeMillis());
+ Random random(clock->TimeInMilliseconds());
// Fuzzing tests.
for (int i = 0; i < 1000; i++) {
if (enlarge_updated_region) {
@@ -229,23 +231,28 @@ void ExecuteDifferWrapperTest(bool with_hints,
} // namespace
TEST(DesktopCapturerDifferWrapperTest, CaptureWithoutHints) {
- ExecuteDifferWrapperTest(false, false, false, true);
+ Clock* clock = Clock::GetRealTimeClock();
+ ExecuteDifferWrapperTest(clock, false, false, false, true);
}
TEST(DesktopCapturerDifferWrapperTest, CaptureWithHints) {
- ExecuteDifferWrapperTest(true, false, false, true);
+ Clock* clock = Clock::GetRealTimeClock();
+ ExecuteDifferWrapperTest(clock, true, false, false, true);
}
TEST(DesktopCapturerDifferWrapperTest, CaptureWithEnlargedHints) {
- ExecuteDifferWrapperTest(true, true, false, true);
+ Clock* clock = Clock::GetRealTimeClock();
+ ExecuteDifferWrapperTest(clock, true, true, false, true);
}
TEST(DesktopCapturerDifferWrapperTest, CaptureWithRandomHints) {
- ExecuteDifferWrapperTest(true, false, true, true);
+ Clock* clock = Clock::GetRealTimeClock();
+ ExecuteDifferWrapperTest(clock, true, false, true, true);
}
TEST(DesktopCapturerDifferWrapperTest, CaptureWithEnlargedAndRandomHints) {
- ExecuteDifferWrapperTest(true, true, true, true);
+ Clock* clock = Clock::GetRealTimeClock();
+ ExecuteDifferWrapperTest(clock, true, true, true, true);
}
// When hints are provided, DesktopCapturerDifferWrapper has a slightly better
@@ -262,34 +269,39 @@ TEST(DesktopCapturerDifferWrapperTest, CaptureWithEnlargedAndRandomHints) {
// [ RUN ] DISABLED_CaptureWithEnlargedAndRandomHintsPerf
// [ OK ] DISABLED_CaptureWithEnlargedAndRandomHintsPerf (6347 ms)
TEST(DesktopCapturerDifferWrapperTest, DISABLED_CaptureWithoutHintsPerf) {
- int64_t started = TimeMillis();
- ExecuteDifferWrapperTest(false, false, false, false);
- ASSERT_LE(TimeMillis() - started, 15000);
+ Clock* clock = Clock::GetRealTimeClock();
+ const Timestamp started = clock->CurrentTime();
+ ExecuteDifferWrapperTest(clock, false, false, false, false);
+ ASSERT_LE(clock->CurrentTime() - started, TimeDelta::Millis(15000));
}
TEST(DesktopCapturerDifferWrapperTest, DISABLED_CaptureWithHintsPerf) {
- int64_t started = TimeMillis();
- ExecuteDifferWrapperTest(true, false, false, false);
- ASSERT_LE(TimeMillis() - started, 15000);
+ Clock* clock = Clock::GetRealTimeClock();
+ const Timestamp started = clock->CurrentTime();
+ ExecuteDifferWrapperTest(clock, true, false, false, false);
+ ASSERT_LE(clock->CurrentTime() - started, TimeDelta::Millis(15000));
}
TEST(DesktopCapturerDifferWrapperTest, DISABLED_CaptureWithEnlargedHintsPerf) {
- int64_t started = TimeMillis();
- ExecuteDifferWrapperTest(true, true, false, false);
- ASSERT_LE(TimeMillis() - started, 15000);
+ Clock* clock = Clock::GetRealTimeClock();
+ const Timestamp started = clock->CurrentTime();
+ ExecuteDifferWrapperTest(clock, true, true, false, false);
+ ASSERT_LE(clock->CurrentTime() - started, TimeDelta::Millis(15000));
}
TEST(DesktopCapturerDifferWrapperTest, DISABLED_CaptureWithRandomHintsPerf) {
- int64_t started = TimeMillis();
- ExecuteDifferWrapperTest(true, false, true, false);
- ASSERT_LE(TimeMillis() - started, 15000);
+ Clock* clock = Clock::GetRealTimeClock();
+ const Timestamp started = clock->CurrentTime();
+ ExecuteDifferWrapperTest(clock, true, false, true, false);
+ ASSERT_LE(clock->CurrentTime() - started, TimeDelta::Millis(15000));
}
TEST(DesktopCapturerDifferWrapperTest,
DISABLED_CaptureWithEnlargedAndRandomHintsPerf) {
- int64_t started = TimeMillis();
- ExecuteDifferWrapperTest(true, true, true, false);
- ASSERT_LE(TimeMillis() - started, 15000);
+ Clock* clock = Clock::GetRealTimeClock();
+ const Timestamp started = clock->CurrentTime();
+ ExecuteDifferWrapperTest(clock, true, true, true, false);
+ ASSERT_LE(clock->CurrentTime() - started, TimeDelta::Millis(15000));
}
} // namespace webrtc
diff --git a/third_party/libwebrtc/moz-patch-stack/s0027.patch b/third_party/libwebrtc/moz-patch-stack/s0027.patch
@@ -866,10 +866,10 @@ index 075e2a8110..1f3a66667a 100644
} else {
cflags = [
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
-index 80036ec012..f45c664600 100644
+index 82c10e4c5f..693e45ff8b 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
-@@ -345,37 +345,12 @@ rtc_library("desktop_capture") {
+@@ -348,37 +348,12 @@ rtc_library("desktop_capture") {
]
deps += [ ":desktop_capture_objc" ]
}
@@ -907,7 +907,7 @@ index 80036ec012..f45c664600 100644
}
if (rtc_use_x11_extensions) {
-@@ -538,9 +513,7 @@ rtc_library("desktop_capture") {
+@@ -541,9 +516,7 @@ rtc_library("desktop_capture") {
deps += [ "../../rtc_base:sanitizer" ]
}
diff --git a/third_party/libwebrtc/moz-patch-stack/s0034.patch b/third_party/libwebrtc/moz-patch-stack/s0034.patch
@@ -263,7 +263,7 @@ index e90ef0e06a..0e96125f40 100644
cflags = [ "-mfpu=neon" ]
}
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
-index f45c664600..4c4366dad2 100644
+index 693e45ff8b..faa88d3543 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
@@ -10,7 +10,7 @@ import("//build/config/linux/gtk/gtk.gni")
diff --git a/third_party/libwebrtc/moz-patch-stack/s0076.patch b/third_party/libwebrtc/moz-patch-stack/s0076.patch
@@ -11,10 +11,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/0ec1b33b95dbb2d39
2 files changed, 7 insertions(+)
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
-index 4c4366dad2..b4860feadb 100644
+index faa88d3543..1bec6da0ca 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
-@@ -389,6 +389,9 @@ rtc_library("desktop_capture") {
+@@ -392,6 +392,9 @@ rtc_library("desktop_capture") {
"Xrender",
"Xtst",
]
diff --git a/third_party/libwebrtc/moz-patch-stack/s0102.patch b/third_party/libwebrtc/moz-patch-stack/s0102.patch
@@ -560,7 +560,7 @@ index 0e96125f40..c72b3714c4 100644
}
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
-index b4860feadb..651ea6ac51 100644
+index 1bec6da0ca..f501b517fd 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
@@ -6,8 +6,8 @@
diff --git a/third_party/libwebrtc/moz-patch-stack/s0114.patch b/third_party/libwebrtc/moz-patch-stack/s0114.patch
@@ -17,10 +17,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/506d4efaf2dc29472
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
-index 651ea6ac51..85aecb7b1e 100644
+index f501b517fd..0a6ccf4011 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
-@@ -554,6 +554,10 @@ rtc_library("desktop_capture") {
+@@ -557,6 +557,10 @@ rtc_library("desktop_capture") {
"../../rtc_base:sanitizer",
"../portal",
]
diff --git a/third_party/libwebrtc/moz-patch-stack/s0119.patch b/third_party/libwebrtc/moz-patch-stack/s0119.patch
@@ -66,10 +66,10 @@ index b2146118ff..cda8733859 100644
static std::unique_ptr<Call> Create(CallConfig config);
diff --git a/modules/desktop_capture/BUILD.gn b/modules/desktop_capture/BUILD.gn
-index 85aecb7b1e..8447de5d9f 100644
+index 0a6ccf4011..aa174d524f 100644
--- a/modules/desktop_capture/BUILD.gn
+++ b/modules/desktop_capture/BUILD.gn
-@@ -391,6 +391,11 @@ rtc_library("desktop_capture") {
+@@ -394,6 +394,11 @@ rtc_library("desktop_capture") {
]
if (build_with_mozilla) {
libs -= [ "Xtst" ]