Re: [whatwg/streams] Explainer for proposed stream changes related to VideoFrame processing (PR #1193)

@MattiasBuelens commented on this pull request.



> +    a background blur effect as a `TransformStream` on each `VideoFrame` of the `MediaStreamTrack`.
+
+## End-user benefit
+
+*   `VideoFrame` needs specific management and be closed as quickly as possible, without relying on garbage collection.
+    This is important to not create hangs/stutters in the processing pipeline. By building support for safe patterns
+    directly in streams, this will allow web developers to optimize `VideoFrame` management, and allow user experience
+    to be more consistent accross devices.
+
+## Principles
+
+The envisioned changes to the streams specification could look like the following:
+*   Add a new 'transfer' type to `ReadableStream`, `WritableStream` and `TransformStream`.
+    For streams that do not have the 'transfer' type, nothing changes.
+*   Streams of the 'transfer' type can only manipulate Transferable or Serializable objects.
+    If a non Transferable or Serializable object is enqueued or written, the object is ignored as if it was never enqueued/written.

This will be more difficult for `writer.write()` though. 🤔 We'd have to do something like this in [WritableStreamDefaultWriterWrite](https://streams.spec.whatwg.org/#writable-stream-default-writer-write):
> 5. If *controller* implements `WritableStreamTransferController`,
>     1. If *chunk* is not `Serializable`, return a promise rejected with a `TypeError`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1193#discussion_r760986271

Received on Thursday, 2 December 2021 11:05:03 UTC