w3c / webcodecs

WebCodecs is a flexible web API for encoding and decoding audio and video.

Home Page:https://w3c.github.io/webcodecs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarify the `Clone configuration` algorithm

padenot opened this issue · comments

When looking a Clone Configuration, and after having found a bug in Gecko, a DOM developer said:

This looks very underspecified in the spec. For one, I don't think any spec defines what assign a copy of config[m] to clone[m]
means. And either that can throw exceptions, and it should be specified what needs to happen, or it doesn't and we need to
figure out what to do in our implementation.

It can throw an exception, a minimal test case (adapted from our bug) would be:

var buf = new ArrayBuffer(4);
buf.transferToFixedLength()
VideoDecoder.isConfigSupported({"codec": "፝a", "description":buf})

Chromium says:

Uncaught (in promise) TypeError: Failed to execute 'isConfigSupported' on 'VideoDecoder': description is detached.

which makes sense to me, but we need to spec it.

Meaning checking if an exception has been thrown, and rejecting the promise.

Same deal with VideoDecoder.configure() with a detached array buffer. Curiously the configuration isn't cloned in this case, but the same behaviour in Chrome (which I also find sensible).

Conceptually this could also be part of the valid VideoDecoderConfig algorithm, which makes sense for something throwing a TypeError.

I agree that it does sound like a part of config validation