RESOLVED FIXED254321
remotemediaplayermanager::supportsTypeAndCodecs will always return false for mediaSource in <source> child
https://bugs.webkit.org/show_bug.cgi?id=254321
Summary remotemediaplayermanager::supportsTypeAndCodecs will always return false for ...
Jean-Yves Avenard [:jya]
Reported 2023-03-23 02:10:03 PDT
Consider the following code: ``` var el = document.createElement("video"); document.body.appendChild(el); var ms = new MediaSource(); const videoSource = document.createElement('source'); videoSource.type = 'video/mp4'; videoSource.src = URL.createObjectURL(ms); el.appendChild(videoSource); ``` when we attempt to find select the new available source, we get to : `HTMLMediaElement::selectNextSourceChild(ContentType` [1] where we have: ```#if ENABLE(MEDIA_SOURCE) parameters.isMediaSource = mediaURL.protocolIs(mediaSourceBlobProtocol); #endif #if ENABLE(MEDIA_STREAM) parameters.isMediaStream = mediaURL.protocolIs(mediaStreamBlobProtocol); #endif ``` both mediaSourceBlobProtocol and mediaStreamBlobProtocol have the same value "blob" and in the JS above would be true. When we go through the MediaPlayerFactory to find the best suitable MediaPlayerPrivate The first one is the RemoteMediaPlayerManager [2] which immediately check if the object is a MediaStream. ``` if (parameters.isMediaStream) return MediaPlayer::SupportsType::IsNotSupported; ``` and as such. RemoteMediaPlayerManager::supportsTypeAndCodecs always return NotSupported ; the next MediaPlayer is in `MediaPlayerPrivateMediaStreamAVFObjC` [3] which test: ``` return (parameters.isMediaStream && !parameters.requiresRemotePlayback) ? MediaPlayer::SupportsType::IsSupported : MediaPlayer::SupportsType::IsNotSupported; ``` and so return true. As such we will not attempt to use the remote decoder and support is incorrectly reported. Considering that `URL.createObjectURL(new MediaStream())` will always return false; (DOMURL only supports Blob and MediaSource objects). Assuming that we could have a blob URL constructed from a MediaStream element and make decision accordingly is nonsensical. This bug was introduced in bug 146752. [1] https://searchfox.org/wubkat/rev/4433b2e3d9c8bf7c4707b1afa1c8bd3a2d13f94d/Source/WebCore/html/HTMLMediaElement.cpp#5155 [2] https://searchfox.org/wubkat/rev/4433b2e3d9c8bf7c4707b1afa1c8bd3a2d13f94d/Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp#220-221 [3] https://searchfox.org/wubkat/rev/4433b2e3d9c8bf7c4707b1afa1c8bd3a2d13f94d/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm#233
Attachments
Radar WebKit Bug Importer
Comment 1 2023-03-23 02:10:28 PDT
Jean-Yves Avenard [:jya]
Comment 2 2023-03-23 02:37:54 PDT
EWS
Comment 3 2023-03-23 05:02:52 PDT
Committed 262013@main (932adf06b671): <https://commits.webkit.org/262013@main> Reviewed commits have been landed. Closing PR #11856 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.