tor-browser

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

commit b46e7fccbc400505242f91c13fec2aacd8827b57
parent c80d23871d4091ca03a0745fc0c2c1ca717bb54e
Author: Anantanarayanan G Iyengar <aiyengar@nvidia.com>
Date:   Wed, 15 Oct 2025 08:59:12 +0000

Bug 1993999 [wpt PR 55392] - Add Web Platform Test for the VideoFrame RTP timestamp feature, a=testonly

Automatic update from web-platform-tests
Add Web Platform Test for the VideoFrame RTP timestamp feature

https://chromestatus.com/feature/5186046555586560

This patch includes the following changes.

1. Web platform Test for the VideoFrame RTP timestamp feature which is
exposed via the metadata object to javascript. For details on the spec
please refer to
https://www.w3.org/TR/webcodecs-video-frame-metadata-registry/#dom-videoframemetadata.

TEST=Web Platform test videoFrame-metadata-rtpTimestamp.https.html

BUG: 414545889
Change-Id: I8810953cb101a765ad815055f49045e5c6ef911f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7019306
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: Anantanarayanan Iyengar US <aiyengar@nvidia.com>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1529015}

--

wpt-commits: 6471d8c7bb1220c70a2199445ccae614c96f9daa
wpt-pr: 55392

Diffstat:
Atesting/web-platform/tests/webcodecs/videoFrame-metadata-rtpTimestamp.https.html | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+), 0 deletions(-)

diff --git a/testing/web-platform/tests/webcodecs/videoFrame-metadata-rtpTimestamp.https.html b/testing/web-platform/tests/webcodecs/videoFrame-metadata-rtpTimestamp.https.html @@ -0,0 +1,75 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>VideoFrame.metadata.rtpTimestamp exposed via MediaStreamTrackProcessor over WebRTC</title> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/webrtc/RTCPeerConnection-helper.js"></script> + +<script> + promise_test(async t => { + if (!("MediaStreamTrackProcessor" in self) || + !("VideoFrame" in self)) { + assert_implements_optional(true, "MediaStreamTrackProcessor/VideoFrame APIs not supported. Skipping test."); + return; + } + + const stream = await getNoiseStream({ video: true }); + const track = stream.getVideoTracks()[0]; + + // This test validates the RTP timestamps on the encoded video frames + // sent by a WebRTC peer (sender) are preserved when received by the + // WebRTC receiver which in turn uses the MediaStreamTrackProcessor + // API to render the video frames. We expect the RTP timestamps to + // be available in the metadata() object exposed by the VideoFrame + // in MediaStreamTrackProcessor if the VideoFrameMetadataRtpTimestamp + // feature is enabled. + + const senderPc = new RTCPeerConnection(); + const receiverPc = new RTCPeerConnection(); + + senderPc.onicecandidate = e => e.candidate && receiverPc.addIceCandidate(e.candidate); + receiverPc.onicecandidate = e => e.candidate && senderPc.addIceCandidate(e.candidate); + + const receiverTrackPromise = new Promise(resolve => { + receiverPc.ontrack = e => resolve(e.track); + }); + + const sender = senderPc.addTrack(track, stream); + + // Offer/Answer exchange + const offer = await senderPc.createOffer(); + await senderPc.setLocalDescription(offer); + await receiverPc.setRemoteDescription(offer); + + const answer = await receiverPc.createAnswer(); + await receiverPc.setLocalDescription(answer); + await senderPc.setRemoteDescription(answer); + + let receiverTrack = await receiverTrackPromise; + + // Send the received track to MediaStreamTrackProcessor for rendering. + const processor = new MediaStreamTrackProcessor({ track: receiverTrack }); + const reader = processor.readable.getReader(); + + const result = await reader.read(); + const frame = result.value; + const metadata = frame.metadata?.(); + + // If the VideoFrameMetadataRtpTimestamp feature is enabled we expect that + // the rtpTimestamp will be available in the metadata. + if (metadata && 'rtpTimestamp' in metadata) { + assert_equals(typeof metadata.rtpTimestamp, "number", "rtpTimestamp should be a number"); + assert_greater_than(metadata.rtpTimestamp, 0, "rtpTimestamp should be non-zero"); + assert_true(true, "rtpTimestamp present in VideoFrame metadata") + } else { + assert_true(true, "rtpTimestamp not present in VideoFrame metadata. Skipping validation because feature may be disabled."); + } + + frame.close(); + receiverTrack.stop(); + track.stop(); + senderPc.close(); + receiverPc.close(); + }, "Check VideoFrame.metadata.rtpTimestamp only when feature is enabled"); +</script>