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

Specify cross-agent-cluster structured cloning for various Web Codecs API objects

padenot opened this issue · comments

There is https://wpt.fyi/results/webcodecs/videoFrame-serialization.crossAgentCluster.https.html?label=experimental&label=master&aligned, that two implementations out of three seem to pass -- that is, do not allow sending objects across agent clusters.

What do we want to do here, is there a use case for posting to other agents clusters?

@youennf tells me that Safari fails for an unrelated reason -- I'll let him comment on the specifics, but it seems that there is some sort of consistency.

Here is another example similar to what web-platform-tests/wpt#41635 (comment) mentioned:

Suppose we have an ImageElement Img in origin A and transferring VideoFrame across origins is valid. The users can do the following things:

  1. Convert Img into VideoFrame V in origin A
  2. Transfer V from origin A to origin B
  3. Convert V into an ImageBitmap M1 in origin B

Since ImageBitmap doesn't define origin-clean in the VideoFrame case, ImageBitmap M1's origin-clean is true. However, creating an ImageBitmap M2 in origin B from an image source in origin A will set the M2's origin-clean to false. Shouldn't M1's origin-clean be false as well?

VideoFrame is the same as ImageData in this example since VideoFrame can't be created from tainted sources. I think this is fine until / unless we want to unlock the ability to work with cross origin VideoFrame objects - at which point we do need origin tracking.