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
<rdar://problem/107125077>
Pull request: https://github.com/WebKit/WebKit/pull/11856
Committed 262013@main (932adf06b671): <https://commits.webkit.org/262013@main> Reviewed commits have been landed. Closing PR #11856 and removing active labels.