w3c / webcodecs

WebCodecs is a flexible web API for encoding and decoding audio and video.
https://w3c.github.io/webcodecs/
Other
985 stars 136 forks source link

Assign VideoFrame resource to [[resource reference]] in BufferSource constructor #772

Closed Yahweasel closed 6 months ago

Yahweasel commented 7 months ago

This is pedantic (hopefully in the way that spec issues should be pedantic).

In the VideoFrame constructor using a BufferSource, nothing actually assigns to [[resource reference]]. In 14.1 and 15.1, we let resource be a media resource, and in 17–20 we get some of its properties (its coded size), but there is no step to actually keep the resource after this algorithm, akin to AudioData's constructor's 4.10, “assign resourceReference to [[resource reference]]”.

This is done correctly in (I believe) every other algorithm that creates a VideoFrame, e.g. the "create a VideoFrame" algorithm, and even in the image source constructor, just not in the buffer source constructor. The constructor does not reference any algorithm to do this otherwise.

padenot commented 7 months ago

Yeah good catch, clearly an oversight, thanks for reporting. This is more like something incorrect rather than pedantic, it's kind of the goal of specifications to be quite specific.

Yahweasel commented 7 months ago

Continuing the pedantry, every other resource assignment has resource reference as "a reference to" resource before assigning it, e.g. https://github.com/w3c/webcodecs/blob/d5a4ed2934b3c7249c31d6fae486c7049aa62fad/index.src.html#L3835

padenot commented 7 months ago

True, but it's all references on the Web, so it's correct.

Yahweasel commented 7 months ago

True, but it's all references on the Web, so it's correct.

Exactly the opinion I had of all the other "reference to resource" mentions in the spec. Was this not going to be a reference? :rofl: