Files
sousa-gecko/testing/web-platform/tests/webcodecs/videoDecoder-codec-specific-orientation.https.any.js
T
Dale Curtis 6e4cb41e67 Bug 1947322 [wpt PR 50618] - Implement orientation support for WebCodecs VideoDecoder., a=testonly
Automatic update from web-platform-tests
Implement orientation support for WebCodecs VideoDecoder.

This implements the current spec language by copying the provided
transform from the VideoDecoderConfig to each output frame. See
https://github.com/w3c/webcodecs/pull/874 for spec details.

As part of this, the codec specific wpt test code is split into
its own file to make adding new tests (to avoid breaking interop
agreements).

R=eugene

Bug: 327625558
Change-Id: I7c96007a27a634c8da80b72266171c8e13645e46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6221543
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Eugene Zemtsov <eugene@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418353}

--

wpt-commits: e905cf1339f0f65cbd8c063f4699aaeae4126587
wpt-pr: 50618
2025-02-12 13:35:36 +00:00

61 lines
1.6 KiB
JavaScript

// META: global=window,dedicatedworker
// META: script=videoDecoder-codec-specific-setup.js
// META: variant=?av1
// META: variant=?vp8
// META: variant=?vp9
// META: variant=?h264_avc
// META: variant=?h264_annexb
// META: variant=?h265_hevc
// META: variant=?h265_annexb
promise_test(async t => {
await checkImplements();
const config = {
...CONFIG,
rotation: 90,
flip: true,
};
const support = await VideoDecoder.isConfigSupported(config);
assert_true(support.supported, 'supported');
assert_equals(support.config.rotation, config.rotation, 'rotation');
assert_equals(support.config.flip, config.flip, 'flip');
}, 'Test that isConfigSupported() with orientation');
promise_test(async t => {
await checkImplements();
const callbacks = {};
const decoder = createVideoDecoder(t, callbacks);
let active_config = {
...CONFIG,
rotation: 90,
flip: true,
};
decoder.configure(active_config);
decoder.decode(CHUNKS[0]);
decoder.decode(CHUNKS[1]);
let outputs = 0;
callbacks.output = frame => {
outputs++;
assert_equals(frame.rotation, active_config.rotation, 'rotation');
assert_equals(frame.flip, active_config.flip, 'flip');
frame.close();
};
await decoder.flush();
assert_equals(outputs, 2, 'outputs');
// Reconfigure with a different orientation.
active_config = {
...CONFIG,
rotation: 180,
flip: false,
};
decoder.configure(active_config);
decoder.decode(CHUNKS[0]);
decoder.decode(CHUNKS[1]);
await decoder.flush();
assert_equals(outputs, 4, 'outputs');
}, 'Decode frames with orientation metadata');