-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider Blob for access to raw buffers #65
Comments
IIUC, this still entails copying. When you construct the blob from an ArrayBuffer, the spec says you copy those bytes. When you get an ArrayBuffer via arrayBuffer(), I think this is again a copy (spec is less clear to me here). |
There is also the opposite case, where we decode a VideoFrame and then want to expose the contents. We can do so as a Blob without copying. There is a proposal to be able to mmap Blobs in WASM, if that lands it could be very helpful. |
https://github.com/Jack-Works/proposal-readonly-arraybuffer are two recent proposals in ES that would be helpful for this. |
triage note: marking 'extension' as proposals above involve new methods/attributes without breaking. |
Related: It would be really nice from a developer experience standpoint if these APIs also consumed Workaround for now is to do const decoder = new ImageDecoder({
type: file.type,
data: new Response(file).body
}); |
Due to the lack of read-only ArrayBuffers, extra copying may be necessary to make some WebCodecs APIs safe.
Blobs however can be read-only. We should investigate whether supporting Blobs in some APIs would be beneficial.
The text was updated successfully, but these errors were encountered: