RESOLVED FIXED 254324
[GPUP][MSE] networkState doesn't move to NETWORK_IDLE once MediaSource.endOfStream() is called
https://bugs.webkit.org/show_bug.cgi?id=254324
Summary [GPUP][MSE] networkState doesn't move to NETWORK_IDLE once MediaSource.endOfS...
Jean-Yves Avenard [:jya]
Reported 2023-03-23 04:37:50 PDT
While the MSE specs provides no extension to HTMLMediaElement's networkState, the spec for the HTML media element provides clear details on how it should behave. In particular in the Resource Fetch Algorithm [1] ``` Once the entire media resource has been fetched (but potentially before any of it has been decoded) Fire an event named progress at the media element. Set the networkState to NETWORK_IDLE and fire an event named suspend at the media element. If the user agent ever discards any media data and then needs to resume the network activity to obtain it again, then it must queue a media element task given the media element to set the networkState to NETWORK_LOADING. ``` With MSE, the player can indicate via `endOfStream()` [2] and the End Of Stream algorithm [3] "This algorithm gets called when the application signals the end of stream via an endOfStream()" the MediaSource readyState moves to `ended` and "Notify the media element that it now has all of the media data." The implication is that we should move the networkState to NETWORK_IDLE and fire the `suspend` event on the video element. The notification from the MediaSource to the MediaPlayer that it is now ended, to the MediaPlayer is done by calling `MediaSourcePrivate->markEndOfStream()` [4] However: for the MediaSourcePrivateRemote we have for the related methods: ``` void MediaSourcePrivateRemote::markEndOfStream(EndOfStreamStatus) { notImplemented(); } void MediaSourcePrivateRemote::unmarkEndOfStream() { notImplemented(); } bool MediaSourcePrivateRemote::isEnded() const { notImplemented(); return false; } ``` As such, the HTMLMediElement is never notified of the change of networkState and we don't fire the `suspend` event. This code is exercised in the test `media/media-source/media-source-end-of-stream.html` when running the MockMediaSource in the GPU Process [see bug 225367) [1] https://html.spec.whatwg.org/multipage/media.html#concept-media-load-resource [2] https://w3c.github.io/media-source/#dom-mediasource-endofstream [3] https://w3c.github.io/media-source/#end-of-stream-algorithm [4] https://searchfox.org/wubkat/rev/4433b2e3d9c8bf7c4707b1afa1c8bd3a2d13f94d/Source/WebCore/Modules/mediasource/MediaSource.cpp#601
Attachments
Radar WebKit Bug Importer
Comment 1 2023-03-23 04:38:26 PDT
Jean-Yves Avenard [:jya]
Comment 2 2023-03-23 05:41:31 PDT
EWS
Comment 3 2023-03-23 08:23:52 PDT
Committed 262016@main (39a3835b1f41): <https://commits.webkit.org/262016@main> Reviewed commits have been landed. Closing PR #11860 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.