summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webrtc-encoded-transform/tentative
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:33 +0000
commit086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch)
treea4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /testing/web-platform/tests/webrtc-encoded-transform/tentative
parentAdding debian version 124.0.1-1. (diff)
downloadfirefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz
firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webrtc-encoded-transform/tentative')
-rw-r--r--testing/web-platform/tests/webrtc-encoded-transform/tentative/RTCEncodedVideoFrame-metadata.https.html140
1 files changed, 140 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webrtc-encoded-transform/tentative/RTCEncodedVideoFrame-metadata.https.html b/testing/web-platform/tests/webrtc-encoded-transform/tentative/RTCEncodedVideoFrame-metadata.https.html
new file mode 100644
index 0000000000..a2c684c1f1
--- /dev/null
+++ b/testing/web-platform/tests/webrtc-encoded-transform/tentative/RTCEncodedVideoFrame-metadata.https.html
@@ -0,0 +1,140 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src=/resources/testdriver.js></script>
+<script src=/resources/testdriver-vendor.js></script>
+<script src='../../mediacapture-streams/permission-helper.js'></script>
+<script src="../../webrtc/RTCPeerConnection-helper.js"></script>
+<script src="../../service-workers/service-worker/resources/test-helpers.sub.js"></script>
+<script src='./../helper.js'></script>
+<script>
+"use strict";
+
+promise_test(async t => {
+ const senderReader = await setupLoopbackWithCodecAndGetReader(t, 'VP8');
+ const result = await senderReader.read();
+ const metadata = result.value.getMetadata();
+ // TODO(https://crbug.com/webrtc/14709): When RTCEncodedVideoFrame has a
+ // constructor, create a new frame from scratch instead of cloning it to
+ // ensure that none of the metadata was carried over via structuredClone().
+ // This would allow us to be confident that setMetadata() is doing all the
+ // work.
+ //
+ // At that point, we can refactor the structuredClone() implementation to be
+ // the same as constructor() + set data + setMetadata() to ensure that
+ // structuredClone() cannot do things that are not already exposed in
+ // JavaScript (no secret steps!).
+ const clone = structuredClone(result.value);
+ clone.setMetadata(metadata);
+ const cloneMetadata = clone.getMetadata();
+ // Encoding-related metadata.
+ assert_equals(cloneMetadata.frameId, metadata.frameId, 'frameId');
+ assert_array_equals(cloneMetadata.dependencies, metadata.dependencies,
+ 'dependencies');
+ assert_equals(cloneMetadata.width, metadata.width, 'width');
+ assert_equals(cloneMetadata.height, metadata.height, 'height');
+ assert_equals(cloneMetadata.spatialIndex, metadata.spatialIndex,
+ 'spatialIndex');
+ assert_equals(cloneMetadata.temporalIndex, metadata.temporalIndex,
+ 'temporalIndex');
+ // RTP-related metadata.
+ // TODO(https://crbug.com/webrtc/14709): This information also needs to be
+ // settable but isn't - the assertions only pass because structuredClone()
+ // copies them for us. It would be great if different layers didn't consider
+ // different subset of the struct as "the metadata". Can we consolidate into a
+ // single webrtc struct for all metadata?
+ assert_equals(cloneMetadata.synchronizationSource,
+ metadata.synchronizationSource, 'synchronizationSource');
+ assert_array_equals(cloneMetadata.contributingSources,
+ metadata.contributingSources, 'contributingSources');
+ assert_equals(cloneMetadata.payloadType, metadata.payloadType, 'payloadType');
+}, "[VP8] setMetadata() carries over codec-specific properties");
+
+promise_test(async t => {
+ const senderReader = await setupLoopbackWithCodecAndGetReader(t, 'VP8');
+ const result = await senderReader.read();
+ const metadata = result.value.getMetadata();
+ const newFrame = new RTCEncodedVideoFrame(result.value);
+ const newMetadata = newFrame.getMetadata();
+
+ // Encoding-related metadata.
+ assert_equals(newMetadata.frameId, metadata.frameId, 'frameId');
+ assert_array_equals(newMetadata.dependencies, metadata.dependencies,
+ 'dependencies');
+ assert_equals(newMetadata.width, metadata.width, 'width');
+ assert_equals(newMetadata.height, metadata.height, 'height');
+ assert_equals(newMetadata.spatialIndex, metadata.spatialIndex,
+ 'spatialIndex');
+ assert_equals(newMetadata.temporalIndex, metadata.temporalIndex,
+ 'temporalIndex');
+
+ // RTP-related metadata.
+ assert_equals(newMetadata.synchronizationSource,
+ metadata.synchronizationSource, 'synchronizationSource');
+ assert_array_equals(newMetadata.contributingSources,
+ metadata.contributingSources, 'contributingSources');
+ assert_equals(newMetadata.payloadType, metadata.payloadType, 'payloadType');
+ assert_equals(newMetadata.rtpTimestamp, metadata.rtpTimestamp, 'rtpTimestamp');
+}, "[VP8] constructor carries over codec-specific properties");
+
+promise_test(async t => {
+ const senderReader = await setupLoopbackWithCodecAndGetReader(t, 'VP8');
+ const result = await senderReader.read();
+ const metadata = result.value.getMetadata();
+ metadata.rtpTimestamp = 100;
+ const newFrame = new RTCEncodedVideoFrame(result.value, metadata);
+ const newMetadata = newFrame.getMetadata();
+
+ // Encoding-related metadata.
+ assert_equals(newMetadata.frameId, metadata.frameId, 'frameId');
+ assert_array_equals(newMetadata.dependencies, metadata.dependencies,
+ 'dependencies');
+ assert_equals(newMetadata.width, metadata.width, 'width');
+ assert_equals(newMetadata.height, metadata.height, 'height');
+ assert_equals(newMetadata.spatialIndex, metadata.spatialIndex,
+ 'spatialIndex');
+ assert_equals(newMetadata.temporalIndex, metadata.temporalIndex,
+ 'temporalIndex');
+
+ // RTP-related metadata.
+ assert_equals(newMetadata.synchronizationSource,
+ metadata.synchronizationSource, 'synchronizationSource');
+ assert_array_equals(newMetadata.contributingSources,
+ metadata.contributingSources, 'contributingSources');
+ assert_equals(newMetadata.payloadType, metadata.payloadType, 'payloadType');
+ assert_equals(newMetadata.rtpTimestamp, metadata.rtpTimestamp, 'rtpTimestamp');
+ assert_not_equals(newMetadata.rtpTimestamp, result.value.getMetadata().rtpTimestamp, 'rtpTimestamp');
+}, "[VP8] constructor with metadata carries over codec-specific properties");
+
+promise_test(async t => {
+ const senderReader = await setupLoopbackWithCodecAndGetReader(t, 'VP8');
+ const result = await senderReader.read();
+ const metadata = result.value.getMetadata();
+ // Change the metadata by setting a new RTPTimestamp.
+ metadata.rtpTimestamp = 100;
+ const newFrame = new RTCEncodedVideoFrame(result.value);
+ const newMetadata = newFrame.getMetadata();
+
+ // Encoding-related metadata.
+ assert_equals(newMetadata.frameId, metadata.frameId, 'frameId');
+ assert_array_equals(newMetadata.dependencies, metadata.dependencies,
+ 'dependencies');
+ assert_equals(newMetadata.width, metadata.width, 'width');
+ assert_equals(newMetadata.height, metadata.height, 'height');
+ assert_equals(newMetadata.spatialIndex, metadata.spatialIndex,
+ 'spatialIndex');
+ assert_equals(newMetadata.temporalIndex, metadata.temporalIndex,
+ 'temporalIndex');
+
+ // RTP-related metadata.
+ assert_equals(newMetadata.synchronizationSource,
+ metadata.synchronizationSource, 'synchronizationSource');
+ assert_array_equals(newMetadata.contributingSources,
+ metadata.contributingSources, 'contributingSources');
+ assert_equals(newMetadata.payloadType, metadata.payloadType, 'payloadType');
+
+ // RTPTimestamp don't match because the constructor did not use the metadata for construction.
+ assert_not_equals(newMetadata.rtpTimestamp, metadata.rtpTimestamp, 'rtpTimestamp');
+ assert_equals(newMetadata.rtpTimestamp, result.value.getMetadata().rtpTimestamp, 'rtpTimestamp');
+}, "[VP8] constructor without metadata does not carry over modified metadata ");
+</script>