Skip to content

Commit

Permalink
Resync WPT WebCodec tests up to 0679447
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=259058
rdar://112018159

Reviewed by Tim Nguyen and Eric Carlson.

Skipping HEVC tests until we have proper support.

* LayoutTests/TestExpectations:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/README.md:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/encoded-video-chunk.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/encoded-video-chunk.any.js:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/encoded-video-chunk.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.html:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.js:
(promise_setup.async const):
(promise_setup):
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.worker.html:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.worker_h265_annexb-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.worker_h265_hevc-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any_h265_annexb-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any_h265_hevc-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/h265.annexb: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/h265.mp4: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any.html:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any.js:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any.worker.html:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any.worker_h265_annexb-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any.worker_h265_hevc-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any_h265_annexb-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any_h265_hevc-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoFrame-construction.any-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoFrame-construction.any.js:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/videoFrame-construction.any.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/webcodecs/w3c-import.log:
* LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/webcodecs/videoFrame-construction.any-expected.txt:

Canonical link: https://commits.webkit.org/265952@main
  • Loading branch information
youennf committed Jul 11, 2023
1 parent babb706 commit 914e049
Show file tree
Hide file tree
Showing 26 changed files with 237 additions and 22 deletions.
10 changes: 10 additions & 0 deletions LayoutTests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -5085,6 +5085,16 @@ imported/w3c/web-platform-tests/html/canvas/offscreen/wide-gamut-canvas/2d.color
imported/w3c/web-platform-tests/webcodecs/videoFrame-createImageBitmap.any.worker.html [ Failure ]
imported/w3c/web-platform-tests/webcodecs/videoFrame-drawImage.any.worker.html [ Failure ]

# HEVC support
imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.html?h265_annexb [ Failure ]
imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.html?h265_hevc [ Failure ]
imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.worker.html?h265_annexb [ Failure ]
imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.worker.html?h265_hevc [ Failure ]
imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any.html?h265_annexb [ Skip ]
imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any.html?h265_hevc [ Skip ]
imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any.worker.html?h265_annexb [ Skip ]
imported/w3c/web-platform-tests/webcodecs/videoDecoder-codec-specific.https.any.worker.html?h265_hevc [ Skip ]

webkit.org/b/226942 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/active-processing.https.html [ Pass Failure ]

webkit.org/b/227849 imported/w3c/web-platform-tests/css/css-overflow/overflow-body-propagation-007.html [ Skip ]
Expand Down
12 changes: 11 additions & 1 deletion LayoutTests/imported/w3c/web-platform-tests/webcodecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ any people can regenerate or update the file in the future.
* When updating the sample offsets and descriptions for tests using mp4 files, it's easiest to use [mp4box.js](https://gpac.github.io/mp4box.js/test/filereader.html).
* Sample offsets can be copied from the "Sample View" tab after unchecking all but offset and size. Use a multi-line edit mode and clang-format to quickly format entries.
* Description entries can be found under moov.trak.mdia.minf.stbl.stsd in box view.
* avc1.avcC has an offset, size in the same view. Add 8 to offset and subtract 8 from the size to get the values the tests want.
* avc1.avcC or hvc1.hvcC has an offset, size in the same view. Add 8 to offset and subtract 8 from the size to get the values the tests want.
* If you use ffprobe -show_packets to get sample offsets, you may need to add 4 to each `pos` value. You can tell if you need to by whether or not tests pass.

## List of Test Files
Expand Down Expand Up @@ -98,6 +98,16 @@ ffmpeg -f lavfi -i testsrc=rate=10:n=1 -t 1 -pix_fmt yuv420p -vcodec h264 -tune
ffmpeg -i h264.mp4 -codec copy -bsf:v h264_mp4toannexb -f h264 h264.annexb
```

### h265.mp4
```
ffmpeg -f lavfi -i testsrc=rate=10:n=1 -t 1 -pix_fmt yuv420p -vcodec hevc -tag:v hvc1 -tune zerolatency h265.mp4
```

### h265.annexb
```
ffmpeg -i h265.mp4 -codec copy -bsf:v hevc_mp4toannexb -f hevc h265.annexb
```

### sfx.adts
```
sox -n -r 48000 sfx.wav synth 1 sine 480
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

PASS Test we can construct an EncodedVideoChunk.
PASS Test copyTo() exception if destiation invalid
PASS Test we can construct an zero-sized EncodedVideoChunk.

Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,15 @@ test(t => {
assert_throws_js(
TypeError,
() => chunk.copyTo(detached), 'destination is detached');
}, 'Test copyTo() exception if destiation invalid');
}, 'Test copyTo() exception if destiation invalid');

test(t => {
let chunk = new EncodedVideoChunk({type: 'key',
timestamp: 10,
duration: 300,
data: new Uint8Array()});
assert_equals(chunk.byteLength, 0, 'byteLength');
let copyDest = new Uint8Array();
chunk.copyTo(copyDest);
assert_equals(copyDest.length, 0, 'copyDest.length');
}, 'Test we can construct an zero-sized EncodedVideoChunk.');
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

PASS Test we can construct an EncodedVideoChunk.
PASS Test copyTo() exception if destiation invalid
PASS Test we can construct an zero-sized EncodedVideoChunk.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
<!-- META: variant=?vp9_p0 -->
<!-- META: variant=?vp9_p2 -->
<!-- META: variant=?h264_avc -->
<!-- META: variant=?h264_annexb -->
<!-- META: variant=?h264_annexb -->
<!-- META: variant=?h265_hevc -->
<!-- META: variant=?h265_annexb -->
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,58 @@
// META: variant=?vp9_p2
// META: variant=?h264_avc
// META: variant=?h264_annexb
// META: variant=?h265_hevc
// META: variant=?h265_annexb

var ENCODER_CONFIG = null;
promise_setup(async () => {
const config = {
// FIXME: H.264 has embedded color space information too.
'?av1': {codec: 'av01.0.04M.08', hasEmbeddedColorSpace: true},
'?vp8': {codec: 'vp8', hasEmbeddedColorSpace: false},
'?vp9_p0': {codec: 'vp09.00.10.08', hasEmbeddedColorSpace: true},
'?vp9_p2': {codec: 'vp09.02.10.10', hasEmbeddedColorSpace: true},
'?av1': {
codec: 'av01.0.04M.08',
hasEmbeddedColorSpace: true,
hardwareAcceleration: 'prefer-software',
},
'?vp8': {
codec: 'vp8',
hasEmbeddedColorSpace: false,
hardwareAcceleration: 'prefer-software',
},
'?vp9_p0': {
codec: 'vp09.00.10.08',
hasEmbeddedColorSpace: true,
hardwareAcceleration: 'prefer-software',
},
'?vp9_p2': {
codec: 'vp09.02.10.10',
hasEmbeddedColorSpace: true,
hardwareAcceleration: 'prefer-software',
},
'?h264_avc': {
codec: 'avc1.42001E',
avc: {format: 'avc'},
hasEmbeddedColorSpace: true
hasEmbeddedColorSpace: true,
hardwareAcceleration: 'prefer-software',
},
'?h264_annexb': {
codec: 'avc1.42001E',
avc: {format: 'annexb'},
hasEmbeddedColorSpace: true
hasEmbeddedColorSpace: true,
hardwareAcceleration: 'prefer-software',
},
'?h265_hevc': {
codec: 'hvc1.1.6.L123.00',
hevc: {format: 'hevc'},
hasEmbeddedColorSpace: true,
hardwareAcceleration: 'prefer-hardware',
},
'?h265_annexb': {
codec: 'hvc1.1.6.L123.00',
hevc: {format: 'annexb'},
hasEmbeddedColorSpace: true,
hardwareAcceleration: 'prefer-hardware',
}
}[location.search];
config.hardwareAcceleration = 'prefer-software';
config.width = 320;
config.height = 200;
config.bitrate = 1000000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
<!-- META: variant=?vp9_p0 -->
<!-- META: variant=?vp9_p2 -->
<!-- META: variant=?h264_avc -->
<!-- META: variant=?h264_annexb -->
<!-- META: variant=?h264_annexb -->
<!-- META: variant=?h265_hevc -->
<!-- META: variant=?h265_annexb -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

FAIL Encoding and decoding cycle promise_test: Unhandled rejection with value: object "InvalidStateError: VideoDecoder is not configured"
FAIL Encoding and decoding cycle w/ stripped color space promise_test: Unhandled rejection with value: object "InvalidStateError: VideoDecoder is not configured"

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

FAIL Encoding and decoding cycle promise_test: Unhandled rejection with value: object "InvalidStateError: VideoDecoder is not configured"
FAIL Encoding and decoding cycle w/ stripped color space promise_test: Unhandled rejection with value: object "InvalidStateError: VideoDecoder is not configured"

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

FAIL Encoding and decoding cycle promise_test: Unhandled rejection with value: object "InvalidStateError: VideoDecoder is not configured"
FAIL Encoding and decoding cycle w/ stripped color space promise_test: Unhandled rejection with value: object "InvalidStateError: VideoDecoder is not configured"

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

FAIL Encoding and decoding cycle promise_test: Unhandled rejection with value: object "InvalidStateError: VideoDecoder is not configured"
FAIL Encoding and decoding cycle w/ stripped color space promise_test: Unhandled rejection with value: object "InvalidStateError: VideoDecoder is not configured"

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
<!-- META: variant=?vp8 -->
<!-- META: variant=?vp9 -->
<!-- META: variant=?h264_avc -->
<!-- META: variant=?h264_annexb -->
<!-- META: variant=?h264_annexb -->
<!-- META: variant=?h265_hevc -->
<!-- META: variant=?h265_annexb -->
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// META: variant=?vp9
// META: variant=?h264_avc
// META: variant=?h264_annexb
// META: variant=?h265_hevc
// META: variant=?h265_annexb

const AV1_DATA = {
src: 'av1.mp4',
Expand Down Expand Up @@ -99,6 +101,43 @@ const H264_ANNEXB_DATA = {
]
};

const H265_HEVC_DATA = {
src: 'h265.mp4',
config: {
codec: 'hev1.1.6.L60.90',
description: {offset: 5821, size: 2406},
codedWidth: 320,
codedHeight: 240,
displayAspectWidth: 320,
displayAspectHeight: 240,
},
chunks: [
{offset: 44, size: 2515}, {offset: 2559, size: 279},
{offset: 2838, size: 327}, {offset: 3165, size: 329},
{offset: 3494, size: 308}, {offset: 3802, size: 292},
{offset: 4094, size: 352}, {offset: 4446, size: 296},
{offset: 4742, size: 216}, {offset: 4958, size: 344}
]
};

const H265_ANNEXB_DATA = {
src: 'h265.annexb',
config: {
codec: 'hev1.1.6.L60.90',
codedWidth: 320,
codedHeight: 240,
displayAspectWidth: 320,
displayAspectHeight: 240,
},
chunks: [
{offset: 0, size: 4894}, {offset: 4894, size: 279},
{offset: 5173, size: 327}, {offset: 5500, size: 329},
{offset: 5829, size: 308}, {offset: 6137, size: 292},
{offset: 6429, size: 352}, {offset: 6781, size: 296},
{offset: 7077, size: 216}, {offset: 7293, size: 344}
]
};

// Allows mutating `callbacks` after constructing the VideoDecoder, wraps calls
// in t.step().
function createVideoDecoder(t, callbacks) {
Expand Down Expand Up @@ -158,7 +197,9 @@ promise_setup(async () => {
'?vp8': VP8_DATA,
'?vp9': VP9_DATA,
'?h264_avc': H264_AVC_DATA,
'?h264_annexb': H264_ANNEXB_DATA
'?h264_annexb': H264_ANNEXB_DATA,
'?h265_hevc': H265_HEVC_DATA,
'?h265_annexb': H265_ANNEXB_DATA
}[location.search];

// Fetch the media data and prepare buffers.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
<!-- META: variant=?vp8 -->
<!-- META: variant=?vp9 -->
<!-- META: variant=?h264_avc -->
<!-- META: variant=?h264_annexb -->
<!-- META: variant=?h264_annexb -->
<!-- META: variant=?h265_hevc -->
<!-- META: variant=?h265_annexb -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

NOTRUN Test isConfigSupported() hev1.1.6.L60.90 unsupported
NOTRUN Test isConfigSupported() with 1080p crop hev1.1.6.L60.90 unsupported
NOTRUN Test that isConfigSupported() returns a parsed configuration hev1.1.6.L60.90 unsupported
NOTRUN Test invalid configs hev1.1.6.L60.90 unsupported
NOTRUN Test configure() hev1.1.6.L60.90 unsupported
NOTRUN Decode a key frame hev1.1.6.L60.90 unsupported
NOTRUN Decode a non key frame first fails hev1.1.6.L60.90 unsupported
NOTRUN Verify reset() suppresses outputs hev1.1.6.L60.90 unsupported
NOTRUN Test unconfigured VideoDecoder operations hev1.1.6.L60.90 unsupported
NOTRUN Test closed VideoDecoder operations hev1.1.6.L60.90 unsupported
NOTRUN Decode empty frame hev1.1.6.L60.90 unsupported
NOTRUN Decode corrupt frame hev1.1.6.L60.90 unsupported
NOTRUN Close while decoding corrupt frame hev1.1.6.L60.90 unsupported
NOTRUN Test decoding after flush hev1.1.6.L60.90 unsupported
NOTRUN Test decoding a with negative timestamp hev1.1.6.L60.90 unsupported
NOTRUN Test reset during flush hev1.1.6.L60.90 unsupported
NOTRUN Test low-latency decoding hev1.1.6.L60.90 unsupported
NOTRUN VideoDecoder decodeQueueSize test hev1.1.6.L60.90 unsupported

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Harness Error (TIMEOUT), message = null

PASS Test isConfigSupported()
PASS Test isConfigSupported() with 1080p crop
PASS Test that isConfigSupported() returns a parsed configuration
PASS Test invalid configs
PASS Test configure()
FAIL Decode a key frame promise_test: Unhandled rejection with value: object "EncodingError: Decoder failure"
PASS Decode a non key frame first fails
TIMEOUT Verify reset() suppresses outputs Test timed out
NOTRUN Test unconfigured VideoDecoder operations
NOTRUN Test closed VideoDecoder operations
NOTRUN Decode empty frame
NOTRUN Decode corrupt frame
NOTRUN Close while decoding corrupt frame
NOTRUN Test decoding after flush
NOTRUN Test decoding a with negative timestamp
NOTRUN Test reset during flush
NOTRUN Test low-latency decoding
NOTRUN VideoDecoder decodeQueueSize test

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

NOTRUN Test isConfigSupported() hev1.1.6.L60.90 unsupported
NOTRUN Test isConfigSupported() with 1080p crop hev1.1.6.L60.90 unsupported
NOTRUN Test that isConfigSupported() returns a parsed configuration hev1.1.6.L60.90 unsupported
NOTRUN Test invalid configs hev1.1.6.L60.90 unsupported
NOTRUN Test configure() hev1.1.6.L60.90 unsupported
NOTRUN Decode a key frame hev1.1.6.L60.90 unsupported
NOTRUN Decode a non key frame first fails hev1.1.6.L60.90 unsupported
NOTRUN Verify reset() suppresses outputs hev1.1.6.L60.90 unsupported
NOTRUN Test unconfigured VideoDecoder operations hev1.1.6.L60.90 unsupported
NOTRUN Test closed VideoDecoder operations hev1.1.6.L60.90 unsupported
NOTRUN Decode empty frame hev1.1.6.L60.90 unsupported
NOTRUN Decode corrupt frame hev1.1.6.L60.90 unsupported
NOTRUN Close while decoding corrupt frame hev1.1.6.L60.90 unsupported
NOTRUN Test decoding after flush hev1.1.6.L60.90 unsupported
NOTRUN Test decoding a with negative timestamp hev1.1.6.L60.90 unsupported
NOTRUN Test reset during flush hev1.1.6.L60.90 unsupported
NOTRUN Test low-latency decoding hev1.1.6.L60.90 unsupported
NOTRUN VideoDecoder decodeQueueSize test hev1.1.6.L60.90 unsupported

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Harness Error (TIMEOUT), message = null

PASS Test isConfigSupported()
PASS Test isConfigSupported() with 1080p crop
PASS Test that isConfigSupported() returns a parsed configuration
PASS Test invalid configs
PASS Test configure()
FAIL Decode a key frame promise_test: Unhandled rejection with value: object "EncodingError: Decoder failure"
PASS Decode a non key frame first fails
TIMEOUT Verify reset() suppresses outputs Test timed out
NOTRUN Test unconfigured VideoDecoder operations
NOTRUN Test closed VideoDecoder operations
NOTRUN Decode empty frame
NOTRUN Decode corrupt frame
NOTRUN Close while decoding corrupt frame
NOTRUN Test decoding after flush
NOTRUN Test decoding a with negative timestamp
NOTRUN Test reset during flush
NOTRUN Test low-latency decoding
NOTRUN VideoDecoder decodeQueueSize test

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PASS Test invalid buffer constructed VideoFrames
PASS Test Uint8Array(ArrayBuffer) constructed I420 VideoFrame
PASS Test ArrayBuffer constructed I420 VideoFrame
PASS Test planar constructed I420 VideoFrame with colorSpace
PASS Test planar constructed I420 VideoFrame with null colorSpace values
PASS Test planar can construct I420 VideoFrame with null colorSpace values
PASS Test buffer constructed I420+Alpha VideoFrame
PASS Test buffer constructed NV12 VideoFrame
PASS Test buffer constructed RGB VideoFrames
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,11 @@ test(t => {
1, 2, // v
]);
let frame = new VideoFrame(data, vfInit);
assert_true(frame.colorSpace.primaries == null, 'color primaries');
assert_true(frame.colorSpace.transfer == null, 'color transfer');
assert_true(frame.colorSpace.matrix == null, 'color matrix');
assert_true(frame.colorSpace.fullRange == null, 'color range');
}, 'Test planar constructed I420 VideoFrame with null colorSpace values');
assert_true(frame.colorSpace.primaries !== undefined, 'color primaries');
assert_true(frame.colorSpace.transfer !== undefined, 'color transfer');
assert_true(frame.colorSpace.matrix !== undefined, 'color matrix');
assert_true(frame.colorSpace.fullRange !== undefined, 'color range');
}, 'Test planar can construct I420 VideoFrame with null colorSpace values');

test(t => {
let fmt = 'I420A';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ PASS Test invalid buffer constructed VideoFrames
PASS Test Uint8Array(ArrayBuffer) constructed I420 VideoFrame
PASS Test ArrayBuffer constructed I420 VideoFrame
PASS Test planar constructed I420 VideoFrame with colorSpace
PASS Test planar constructed I420 VideoFrame with null colorSpace values
PASS Test planar can construct I420 VideoFrame with null colorSpace values
PASS Test buffer constructed I420+Alpha VideoFrame
PASS Test buffer constructed NV12 VideoFrame
PASS Test buffer constructed RGB VideoFrames
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ List of files:
/LayoutTests/imported/w3c/web-platform-tests/webcodecs/full-cycle-test.https.any.js
/LayoutTests/imported/w3c/web-platform-tests/webcodecs/h264.annexb
/LayoutTests/imported/w3c/web-platform-tests/webcodecs/h264.mp4
/LayoutTests/imported/w3c/web-platform-tests/webcodecs/h265.annexb
/LayoutTests/imported/w3c/web-platform-tests/webcodecs/h265.mp4
/LayoutTests/imported/w3c/web-platform-tests/webcodecs/idlharness.https.any.js
/LayoutTests/imported/w3c/web-platform-tests/webcodecs/image-decoder-disconnect-readable-stream-crash.https.html
/LayoutTests/imported/w3c/web-platform-tests/webcodecs/image-decoder-image-orientation-none.https.html
Expand Down
Loading

0 comments on commit 914e049

Please sign in to comment.