commit ddf4abd0e3fbb7a436b0a05afe3ec85ec27f1676
parent 40b68f1baa72655e79def00a30d6de5a90ab745a
Author: Jan-Ivar Bruaroey <jib@mozilla.com>
Date: Fri, 31 Oct 2025 16:51:35 +0000
Bug 1995644 - reuse expensive frame across tests to speed up RTCEncodedFrame-copy-construction.https.html WPT. r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D270586
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/testing/web-platform/tests/webrtc-encoded-transform/RTCEncodedFrame-copy-construction.https.html b/testing/web-platform/tests/webrtc-encoded-transform/RTCEncodedFrame-copy-construction.https.html
@@ -16,8 +16,11 @@
const assert_json_equals = (a, b) => assert_equals(JSON.stringify(a), JSON.stringify(b));
const assert_json_not_equals = (a, b) => assert_not_equals(JSON.stringify(a), JSON.stringify(b));
+const reuse = {}; // speed up tests
+
promise_test(async t => {
const frame = await createRTCEncodedFrameFromScratch("video");
+ reuse["video"] = frame;
assert_true(frame instanceof RTCEncodedVideoFrame);
assert_equals(frame.type, "key"); // first frame is key
@@ -30,6 +33,7 @@ promise_test(async t => {
promise_test(async t => {
const frame = await createRTCEncodedFrameFromScratch("audio");
+ reuse["audio"] = frame;
assert_true(frame instanceof RTCEncodedAudioFrame);
const clone = new RTCEncodedAudioFrame(frame);
@@ -52,7 +56,7 @@ function different(value) {
const kind = constr.includes("Video")? "video" : "audio";
promise_test(async t => {
- const frame = await createRTCEncodedFrameFromScratch(kind);
+ const frame = reuse[kind];
const oldData = frame.getMetadata();
// test single key replacement
for (const key of Object.keys(oldData)) {
@@ -78,7 +82,7 @@ function different(value) {
}, `${constr} copy construction metadata override on main thread.`);
promise_test(async t => {
- const frame = await createRTCEncodedFrameFromScratch(kind);
+ const frame = reuse[kind];
assert_greater_than(frame.data.byteLength, 0);
const length = frame.data.byteLength;
const clone = structuredClone(frame);
@@ -88,7 +92,7 @@ function different(value) {
}, `${constr} structuredClone on main thread.`);
promise_test(async t => {
- const frame = await createRTCEncodedFrameFromScratch(kind);
+ const frame = reuse[kind];
assert_greater_than(frame.data.byteLength, 0);
const length = frame.data.byteLength;
const clone = structuredClone(frame, {transfer: [frame.data]});