Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 514ac2547e6f001230587536baf3c5da4b060272
      
https://github.com/WebKit/WebKit/commit/514ac2547e6f001230587536baf3c5da4b060272
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2026-06-26 (Fri, 26 Jun 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/MediaPlayer.cpp
    M Source/WebCore/platform/graphics/MediaPlayer.h
    M Source/WebCore/platform/graphics/MediaPlayerEnums.h
    M Source/WebCore/platform/graphics/MediaPlayerPrivateWirelessPlayback.cpp
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
    M Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm
    M 
Source/WebCore/platform/graphics/cocoa/PlatformMediaEngineConfigurationFactoryCocoa.cpp
    M Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp
    M Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.h

  Log Message:
  -----------
  Don't register MediaPlayerPrivateWebM / MediaPlayerPrivateMediaSourceAVFObjC 
for playback in the GPU process when MediaContainment is enabled
https://bugs.webkit.org/show_bug.cgi?id=317846
rdar://180623633

Reviewed by Youenn Fablet.

The registration policy lived in MediaPlayer::buildMediaEnginesVector with
a hand-written MESSAGE_CHECK allowlist in 
RemoteMediaPlayerManagerProxy::createMediaPlayer.
MediaPlayerPrivateWebM and MediaPlayerPrivateMediaSourceAVFObjC were
registered in every process where their code compiled, including the
GPU process; the MESSAGE_CHECK rejected attempts to instantiate them
in GPU when MediaContainment was on, but the canDecodeExtendedType IPC
had no way to express "answer codec capability queries from GPU
without being instantiable." When MediaContainment is enabled, those
engines demux in the WebContent process and only the renderer should
live in GPU, so registering the full MediaPlayerPrivate in GPU was
both unnecessary and a defence-in-depth weak point.

This commit moves the decision of when and where a MediaPlayerFactory
is registered into each MediaPlayerPrivate's static registerMediaEngine
— the factory itself owns it. buildMediaEnginesVector becomes a flat
list of registerMediaEngine calls (still gated by USE/ENABLE compile
flags and the existing isAVFoundationEnabled / isGStreamerEnabled
runtime gates); each engine's static decides between installing the
local factory, delegating to a remote proxy via
RemoteMediaPlayerSupport::registerRemoteEngineIfAvailable, or skipping.

MediaPlayerFactory gains a MediaPlayerScope 
supportedScope(MediaContainmentEnabled)
the describes how the MediaPlayerPrivate is to be used.
MediaPlayer::supportsType and MediaPlayer::mediaEngine take a
MediaPlayerEngineSelection { identifier, scope, mediaContainmentEnabled }
struct, and engines are filtered by scope. MediaPlayerFactoryWebM and
MediaPlayerFactoryMediaSourceAVFObjC override supportedScope to return
RemoteRenderingCapability in the GPU process when MediaContainmentEnabled
is Yes — they can answer canDecodeExtendedType IPCs from the WebContent
demuxer but are not lookup-able for Playback.

GPUConnectionToWebProcess::canDecodeExtendedType queries with
MediaPlayerScope::RemoteRenderingCapability and the connection's
MediaContainmentEnabled. RemoteMediaPlayerManagerProxy::{createMediaPlayer,
getSupportedTypes, supportsTypeAndCodecs, supportsKeySystem} all funnel
through a new playbackEngineForConnection helper that queries with
MediaPlayerScope::Playback and the connection's preference;
createMediaPlayer's old MESSAGE_CHECK allowlist is replaced by this
registry lookup, so a containment-enabled connection asking the GPU
to instantiate WebM or MSE AVF is rejected by the registry rather
than a hand-maintained list.

This is required to disable the use of MediaPlayerPrivateRemote (the
WebContent-side remote proxy) with the WebM and MediaSource AVF
players without breaking the WebContent-side demuxer's ability to
query the GPU for codec capabilities.

* Source/WebCore/platform/graphics/MediaPlayerEnums.h: Add
MediaPlayerScope and MediaContainmentEnabled.
* Source/WebCore/platform/graphics/MediaPlayer.h:
* Source/WebCore/platform/graphics/MediaPlayer.cpp:
(WebCore::buildMediaEnginesVector):
(WebCore::bestMediaEngineForSupportParameters):
(WebCore::MediaPlayer::mediaEngine):
(WebCore::MediaPlayer::supportsType):
(WebCore::RemoteMediaPlayerSupport::registerRemoteEngineIfAvailable):
* Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.{h,mm}:
(WebCore::MediaPlayerFactoryWebM::supportedScope):
(WebCore::MediaPlayerPrivateWebM::registerMediaEngine):
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.{h,mm}:
(WebCore::MediaPlayerFactoryMediaSourceAVFObjC::supportedScope):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine):
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.{h,mm}:
(WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine):
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.{h,mm}:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::registerMediaEngine):
* Source/WebCore/platform/graphics/MediaPlayerPrivateWirelessPlayback.{h,cpp}:
(WebCore::MediaPlayerPrivateWirelessPlayback::registerMediaEngine):
* 
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.{h,cpp}:
* 
Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.{h,cpp}:
* 
Source/WebCore/platform/graphics/holepunch/MediaPlayerPrivateHolePunch.{h,cpp}:
* 
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.{h,cpp}:
* Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.{h,cpp}:
* Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::canDecodeExtendedType):
* Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.{h,cpp}:
(WebKit::RemoteMediaPlayerManagerProxy::playbackEngineForConnection):
(WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer):
(WebKit::RemoteMediaPlayerManagerProxy::getSupportedTypes):
(WebKit::RemoteMediaPlayerManagerProxy::supportsTypeAndCodecs):
(WebKit::RemoteMediaPlayerManagerProxy::supportsKeySystem):
* Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
(WebKit::RemoteMediaPlayerManager::setUseGPUProcess):

Canonical link: https://commits.webkit.org/315905@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to