-
Notifications
You must be signed in to change notification settings - Fork 164
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
Should there be dedicated VideoFrame ReadableStream/WritableStream constructs #1187
Comments
Following on last meeting discussion, a potential approach would be something like:
This makes the API contract very clear. Taking ownership could be implemented in various ways:
The added complexity to the streams implementation seems mild. One potential disadvantage happens for transferred streams. Thoughts? |
Maybe relevant (re close-able trait) https://github.com/tc39/proposal-explicit-resource-management (not suggesting we wait for this in any fashion, but it may provide useful directions) |
Transferable solves the problem of moving ownership, but it doesn't solve explicit cleanup. The explicit resource management proposal seems problematic when combined with transferable objects. What happens if user-land code overrides We could add a concept for closeable objects, on the same level as transferable objects. Closeable IDL interfaces must be annotated with Of course, the disadvantage is that regular JavaScript objects cannot be made closeable, so they cannot benefit from this cleanup mechanism. But perhaps we can still fix this in the future? If
That way, platform objects like We probably shouldn't assume that every stream containing closeable chunks wants those chunks to be closed in this way. If the chunks aren't transferable (which will be the case for user-land objects), then they may still be used outside the stream. So I would make this an opt-in with some sort of
|
https://tc39.es/proposal-explicit-resource-management/ has reached stage 3 |
As seen in various threads, using VideoFrame requires explicit closing, for instance when aborting streams.
Tee might be an issue, requiring to use structured cloning and a realtime mode to ensure limited buffering and branch independence.
If we start adding features for VideoFrame, we can wonder whether dedicated stream constructs for VideoFrame, like BYOB for array buffers, could be more ergonomic.
The text was updated successfully, but these errors were encountered: