Copied from a comment I made on bug 774771, which is about pausing the <video> element that's fed from a MediaStream obtained from mozGetUserMedia().

  Randell

****
Correct - the MediaStream producer (if it can't push) should throw away data. However...

Roc - is this the correct place? if the consumer stops consuming a realtime stream, you could either freeze the mediastream graph (and drop data at the input), or keep it running and throw away at the output.

The argument for keeping it running if the consumer blocks (Pauses) is that if there are two consumers (second MediaStream forked from some tracks of the first), it would get paused too (which is a bad thing). (Think camera input, forked to two different <video> elements (such as showing different effects, etc), and the user pausing one.)

So, I think what should be happening here is that a mediastream (at least one with a realtime source) should throw away at the output if the consumer doesn't consume.

MediaStreams with non-realtime sources - you could make an argument for Pause bubbling up and pausing the source, at least if there are no un-paused consumers.

I'm going to post this to dev.media, since this is largely an architectural discussion.

****

Expanding on the bubbling comment: we've talked for a number of purposes about bubbling events/requests up through MediaStreams to their source(s) - for example for camera control. This would be another use. The only "interesting" part of this is when tracks split into two MediaStreams or are combined with other tracks into a "bigger" MediaStream (since tracks in the same MediaStream are supposed to be synced).

Pause on a MediaStream should pause all the tracks; if one can't pause - should the others continue, or should they pause? It would be odd for one track to pause and the others to continue, so I think we'd want them to be all-or-nothing in this case.

All of this presumes we want to offer the option to Pause a MediaStream - a use case would be a MediaStream sourced from a <video> element decoding a file or a streamed (pausable) resource, running through perhaps a MediaStream Processing graph, and then displayed in another <video> element. How does the user Pause the video he's seeing? Normally he'd expect he should be able to, but the two video elements are different.

The alternative to bubbling of requests is to handle pause by blocking the stream if the consumer stops, and letting the input either drop (realtime) or pause (pausable). As mentioned above, this causes a problem if the track is being fed to two different consumers, however.

--
Randell Jesup, Mozilla
_______________________________________________
dev-media mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-media

Reply via email to