Re: [streams] Real time source and skipping (#383)

I thought about a Transform but I'm having a hard time seeing how that would work:
- for real-time push sources, you want to read from the stream as fast as possible and cache the latest frame / chunk.
- for on demand sources, you want to only read from the stream if the the following consumer needs it.

I don't see how to reconcile this with the logic in `pipeTo` and `TransformStream`:
For real-time push source, the `writable` stream of the Transform passed to `pipeTo` should basically apply no back pressure so that the it can consume everything produced and skip intermediate frames / chunks.
But this behavior doesn't work for on-demand sources since, well the back pressure would be gone, negating their nice property of being on demand.

The consumer of the stream might not know if the underlying source is real-time / push or not.

PS: I'm using the example of video frames as it's relevant to me in this case, and is easy to comprehend, but really this applies to any problem where we want to skip intermediate values in the stream and pass through the "last-in" when pulling. "first-in" is easy as you can implement that by discarding newly read values in a transform if the destination stream's queue is full.
Another use case of a "real-time" push source and skipping intermediate value but the latest would be a stream of cursor positions. If I wasn't able to listen to positions for a bit, I don't care where it was during that time, I only care where it is now, but I also don't want to wait to know that until the cursor moves again. Makes sense?

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/383#issuecomment-126426265

Received on Thursday, 30 July 2015 18:32:23 UTC