Re: [mediacapture-insertable-streams] Is using ReadableStream/WritableStream the right approach? (#4)

> It's not clear to me what "not as safe as" refers to here
It refers to the fact that you might end up buffering frames or doing copies.
Cloning a MediaStreamTrack is not triggering those issues, there is no JS objects involved, there is no hard guarantee video frames will be exactly the same between cloned tracks, though there is an assumption they should be the same as much as possible. Depending on implementations, cloned MediaStreamTrack with software-based decimation (size or frame rate) might slightly differ for instance.

> one can construct these from any source.

That is indeed an important point.
First, we can note this is only a problem for video. For audio, WebAudio allows reading and writing MediaStreamTrack.

While anyone can construct streams however they want, streams are not consumable by any existing media API (HTMLMediaElement, MediaRecorder, RTCPeerConnection).
I doubt we will add new methods taking streams as input for these APIs (or is it the plan?). Instead, we might simply create the ability to feed a MediaStreamTrack with video frames through JS. Such a construct might not be difficult to implement and specify.
Once we have that construct, it is unclear what benefits we get from exposing streams, at least in window environments.
In worker environment, where would happen the actual frame by frame processing, we indeed need some form of exposing frames in a natural manner, stream is a possibility.

> This is important for several applications, including using WebCodecs to encode/decode, and for using other transports than PeerConnection to move data around.

These are new APIs. Do they plan to use streams, frames or both as input?
Looking at https://wicg.github.io/web-codecs/#mediastreamtrack-monitoring, it seems the envisioned way is to expose MediaStreamTrack frames with a callback-based API.

-- 
GitHub Notification of comment by youennf
Please view or discuss this issue at https://github.com/w3c/mediacapture-insertable-streams/issues/4#issuecomment-763774877 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 20 January 2021 16:43:22 UTC