Closed
Labels
editors-agendaAdd to agenda for upcoming editors callextensionInterface changes that extend without breaking.
Description
An app may have a frame (video or audio) but want to change its metadata (timestamp, duration, colorspace) before passing it to another component. I propose that we extend clone() to take an initialization dictionary that allows this metadata to be overwritten in the clone. It would probably make sense for any introduced copy() API to do the same.
Metadata
Metadata
Assignees
Labels
editors-agendaAdd to agenda for upcoming editors callextensionInterface changes that extend without breaking.
Activity
padenot commentedon Apr 6, 2021
Having the capability to do this would be very useful. With copy-on-write semantics your API suggestion sounds fine in terms of performance, but maybe a bit unfamiliar to developers.
chcunningham commentedon May 12, 2021
Triage note: marked 'extension' as the proposal is describing adding new arguments to a method.
padenot commentedon May 17, 2021
I tend to agree in practice, but this is breaking in theory (
.lengthon the method changes).sandersdan commentedon May 21, 2021
Note: now that we support construction from a
CanvasImageSource, andVideoFrameis aCanvasImageSource, this can be written asnew VideoFrame(originalFrame, { /* new metadata */ }), and Chrome's implementation already supports overriding a timestamp in this way.I think it may be surprising that this construction clones rather than copies, but the spec is already quite clear on this point.
Maybe we don't actually need
clone()at all?chcunningham commentedon Jan 18, 2022
@sandersdan what are your feelings as of late? Do you want to see metadata overrides added to clone() or is the VideoFrame constructor option sufficient? I can see it either way (i.e. symmetry is nice, but argument could also be made that clone() is the "simple" option).
sandersdan commentedon Jan 18, 2022
I no longer feel strongly about
copy()andclone()supporting these options. It would presumably be trivial to support that use, but the added complexity in teaching the API is probably not worth it.I suppose there is also the inverse to consider, an option for
new VideoFrame()to force copy semantics. This has the advantage of actually highlighting the default clone behavior, but of course is not async which likely is a showstopper.chcunningham commentedon Jan 19, 2022
Ok, lets close this for now. If we hear folks hate the current options we'll reconsider.