Skip to content

Commit

Permalink
Bug 1810112 [wpt PR 37929] - Add codec specifics and additional info …
Browse files Browse the repository at this point in the history
…to RTCEncodedVideoFrameMetadata., a=testonly

Automatic update from web-platform-tests
Add codec specifics and additional info to RTCEncodedVideoFrameMetadata.

Limiting the scope to VP8 for now, but the plumbing is such that adding
VP9 and H264 support in follow-ups should be straight-forward.

I2P: https://groups.google.com/a/chromium.org/g/blink-dev/c/x2ZACgXrqp0/m/rcHJwOKtBAAJ
RuntimeEnabled flag: RTCEncodedVideoFrameAdditionalMetadata

Bug: webrtc:14709
Change-Id: I052c4d90b897d0e241c4899852398a7553d8f745
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4161702
Commit-Queue: Henrik Boström <[email protected]>
Reviewed-by: Harald Alvestrand <[email protected]>
Reviewed-by: Mike West <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1093002}

--

wpt-commits: 7bd79158bcaf05721facb434d9562d79ecd2176e
wpt-pr: 37929
  • Loading branch information
henbos authored and moz-wptsync-bot committed Jan 18, 2023
1 parent d3eb00a commit af44969
Showing 1 changed file with 69 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<!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>
"use strict";

async function setupLoopbackWithCodecAndGetReader(t, codec) {
const caller = new RTCPeerConnection({encodedInsertableStreams:true});
t.add_cleanup(() => caller.close());
const callee = new RTCPeerConnection();
t.add_cleanup(() => callee.close());

await setMediaPermission("granted", ["camera"]);
const stream = await navigator.mediaDevices.getUserMedia({video:true});
const videoTrack = stream.getVideoTracks()[0];
t.add_cleanup(() => videoTrack.stop());

const transceiver = caller.addTransceiver(videoTrack);
const codecCapability =
RTCRtpSender.getCapabilities('video').codecs.find(capability => {
return capability.mimeType.includes(codec);
});
assert_not_equals(codecCapability, undefined);
transceiver.setCodecPreferences([codecCapability]);

const senderStreams = transceiver.sender.createEncodedStreams();
exchangeIceCandidates(caller, callee);
await exchangeOfferAnswer(caller, callee);
return senderStreams.readable.getReader();
}

promise_test(async t => {
const senderReader = await setupLoopbackWithCodecAndGetReader(t, 'VP8');
const result = await senderReader.read();
const metadata = result.value.getMetadata();
// RTCEncodedVideoFrameAdditionalMetadata-only fields.
assert_true(Array.isArray(metadata.decodeTargetIndications),
'decodeTargetIndication is an array');
assert_equals(typeof metadata.isLastFrameInPicture, 'boolean',
'isLastFrameInPicture is a boolean');
assert_equals(typeof metadata.simulcastIdx, 'number',
'simulcastIdx is a number');
assert_equals(metadata.codec, 'vp8');
assert_equals(typeof metadata.codecSpecifics, 'object',
'codecSpecifics is an object');
// VP8-only
assert_equals(typeof metadata.codecSpecifics.nonReference, 'boolean',
'codecSpecifics.nonReference is a boolean');
assert_equals(typeof metadata.codecSpecifics.pictureId, 'number',
'codecSpecifics.pictureId is a number');
assert_equals(typeof metadata.codecSpecifics.tl0PicIdx, 'number',
'codecSpecifics.tl0PicIdx is a number');
assert_equals(typeof metadata.codecSpecifics.temporalIdx, 'number',
'codecSpecifics.temporalIdx is a number');
assert_equals(typeof metadata.codecSpecifics.layerSync, 'boolean',
'codecSpecifics.layerSync is a boolean');
assert_equals(typeof metadata.codecSpecifics.keyIdx, 'number',
'codecSpecifics.keyIdx is a number');
assert_equals(typeof metadata.codecSpecifics.partitionId, 'number',
'codecSpecifics.partitionId is a number');
assert_equals(typeof metadata.codecSpecifics.beginningOfPartition, 'boolean',
'codecSpecifics.beginningOfPartition is a boolean');
}, "[VP8] getMetadata() supports the expected codec specifics");
</script>

0 comments on commit af44969

Please sign in to comment.