[whatwg/streams] Reset for TransformStream (and WritableStream?) (#1026)

On seek, [WebCodecs](https://github.com/WICG/web-codecs/blob/master/explainer.md) would like to be able to throw away all existing data in the decoder so that they don't display any more frames from before the seek point.

It's easy enough to reset the decoder itself, but there still may be data queued in the writable side of the transform which we need to get rid of. There doesn't seem to be a clean way to do this at the moment.

I tentatively propose a `reset()` method for TransformStream which throws away any queued chunks. This might delegate to abstract operations on ReadableStream and WritableStream which do the actual queue reset.

It would probably be useful to have an optional `reset()` method on the underlying transformer. This would have unusual semantics that it could be called while a transform is in progress.

`reset()` might also be useful for WritableStream although I don't have a specific use case. It might even be useful for ReadableStream but I'm even further from having a use case for that.

-- 
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/issues/1026

Received on Thursday, 30 January 2020 03:24:53 UTC