Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 468654de4a9e634b8d76babd8720bc060ed1df60
      
https://github.com/WebKit/WebKit/commit/468654de4a9e634b8d76babd8720bc060ed1df60
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2025-10-04 (Sat, 04 Oct 2025)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/media-source/dedicated-worker/mediasource-worker-play-expected.txt
    M Source/WebCore/SaferCPPExpectations/UnretainedLocalVarsCheckerExpectations
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm
    M 
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h
    M 
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
    M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h
    M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm

  Log Message:
  -----------
  Adopt AudioVideoRendererAVFObjC in MediaPlayerPrivateMediaSourceAVFObjC
https://bugs.webkit.org/show_bug.cgi?id=298507
rdar://160036437

Reviewed by Jer Noble.

We adopt the use of the AudioVideoRendererAVFObjC in 
MediaPlayerPrivateMediaSourceAVFObjC
and related objects (MediaSourcePrivateAVFObjC and SourceBufferPrivateAVFObjC).
This abstract the interaction with the video and audio layer so that the 
SourceBufferPrivate
no longer has to manually managed the various renderers and the switching 
between rendering mode
(such as on visionOS when you dock/undock the video).
This abstraction was necessary so that the MediaSourcePrivate and 
SourceBufferPrivate
can now be moved to the content process.

It also removes the continuous round-trips from the GPUP to CP and back whenever
the SourceBufferPrivate needed to interact with the MediaPlayer such as when 
data was added
or removed, a seek operation was performed etc.
The controls of stalling/resuming playback is now managed all in-process
allowing the playback to stall and resume much quicker whenever new data is 
added.

We can also achieve feature parity between the MSE and WebM players and will 
allow much
easier future maintenance as now the audio and video renderer and A/V sync is 
common
between the two players.

No change in observable behaviours, covered by existing tests.
Intensive manual testing was done to test protected content site such as 
Netflix,
Amazon Prime and HBO) which are poorly covered by our tests.

* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::audioVideoRenderer const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::allRenderersHaveAvailableSamples
 const): Deleted.
(WTF::LogArgument<WebCore::MediaPlayerPrivateMediaSourceAVFObjC::SeekState>::toString):
 Deleted.
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::~MediaPlayerPrivateMediaSourceAVFObjC):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isAvailable):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::load):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setResourceOwner):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playInternal):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pauseInternal):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::paused const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPageIsVisible):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::currentTime const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::timeIsProgressing const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::startSeek):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cancelPendingSeek):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::completeSeek):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setRateDouble):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::effectiveRate const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::bufferedChanged):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setLayerRequiresFlush):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::flushVideoIfNeeded):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::flush):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::reenqueueMediaForTime):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastVideoFrame):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastImage):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::maybePurgeLastImage):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoFrameForCurrentTime):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPresentationSize):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedRenderingStateChanged):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::shouldBePlaying const):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::needsVideoLayerChanged):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setReadyState):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::characteristicsChanged):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::performTaskAtTime):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::audioOutputDeviceChanged):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::startVideoFrameMetadataGathering):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::checkNewVideoFrameMetadata):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::stopVideoFrameMetadataGathering):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setShouldDisableHDR):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPlatformDynamicRangeLimit):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::playerContentBoxRectChanged):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setShouldMaintainAspectRatio):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateSpatialTrackingLabel):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoTarget):
(WebCore::MediaPlayerPrivateWebM::applicationWillResignActive):
(WebCore::MediaPlayerPrivateWebM::applicationDidBecomeActive):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isInFullscreenOrPictureInPictureChanged):
(WebCore::convertEnumerationToString): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::clampTimeToSensicalValue 
const): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCurrentTimeDidChangeCallback):
 Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::maybeCompleteSeek): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateLastPixelBuffer): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::shouldEnsureLayerOrVideoRenderer
 const): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoLayerSizeFenced): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateDisplayLayer): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::prepareForRendering): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyVideoLayerIfNeeded): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureVideoRenderer): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyVideoRenderer): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isUsingRenderlessMediaSampleRenderer
 const): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureRenderlessVideoMediaSampleRenderer):
 Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyRenderlessVideoMediaSampleRenderer):
 Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayerOrVideoRendererWithDecompressionSession):
 Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayerOrVideoRenderer): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayerOrVideoRenderer): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::configureLayerOrVideoRenderer): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoRenderer): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::stageVideoRenderer): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::createVideoMediaSampleRendererForRendererer):
 Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::acceleratedVideoMode const): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::canUseDecompressionSession 
const): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isUsingDecompressionSession 
const): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::willUseDecompressionSessionIfNeeded
 const): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setSynchronizerRate): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateAllRenderersHaveAvailableSamples):
 Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime): Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::flushPendingSizeChanges): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setNeedsPlaceholderImage): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFrameMetadataGatheringCallbackIfNeeded):
 Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::hasVideoRenderer const): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::layerOrVideoRenderer const): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::applicationWillResignActive): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::applicationDidBecomeActive): 
Deleted.
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::maybeUpdateDisplayLayer): 
Deleted.
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
(WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer):
(WebCore::MediaSourcePrivateAVFObjC::flushActiveVideoSourceBuffers):
(WebCore::MediaSourcePrivateAVFObjC::cdmInstanceAttached):
(WebCore::MediaSourcePrivateAVFObjC::cdmInstanceDetached):
(WebCore::MediaSourcePrivateAVFObjC::setSourceBufferWithSelectedVideo):
(WebCore::MediaSourcePrivateAVFObjC::setVideoRenderer): Deleted.
(WebCore::MediaSourcePrivateAVFObjC::stageVideoRenderer): Deleted.
(WebCore::MediaSourcePrivateAVFObjC::videoRendererWillReconfigure): Deleted.
(WebCore::MediaSourcePrivateAVFObjC::videoRendererDidReconfigure): Deleted.
(WebCore::MediaSourcePrivateAVFObjC::flushActiveSourceBuffersIfNeeded): Deleted.
(WebCore::MediaSourcePrivateAVFObjC::applicationWillResignActive): Deleted.
(WebCore::MediaSourcePrivateAVFObjC::applicationDidBecomeActive): Deleted.
* 
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
* 
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::create):
(WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC):
(WebCore::SourceBufferPrivateAVFObjC::isMediaSampleAllowed const):
(WebCore::SourceBufferPrivateAVFObjC::updateTrackIds):
(WebCore::SourceBufferPrivateAVFObjC::destroyRendererTracks):
(WebCore::SourceBufferPrivateAVFObjC::removedFromMediaSource):
(WebCore::SourceBufferPrivateAVFObjC::trackDidChangeSelected):
(WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
(WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
(WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
(WebCore::SourceBufferPrivateAVFObjC::trackIdentifierFor const):
(WebCore::SourceBufferPrivateAVFObjC::setVideoRenderer):
(WebCore::SourceBufferPrivateAVFObjC::flush):
(WebCore::SourceBufferPrivateAVFObjC::flushVideo):
(WebCore::SourceBufferPrivateAVFObjC::canEnqueueSample):
(WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
(WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples):
(WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples):
(WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
(WebCore::SourceBufferPrivateAVFObjC::canSetMinimumUpcomingPresentationTime 
const):
(WebCore::SourceBufferPrivateAVFObjC::setMinimumUpcomingPresentationTime):
(WebCore::SourceBufferPrivateAVFObjC::destroyRenderers): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::requiresFlush const): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::flushIfNeeded): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::audioRendererWasAutomaticallyFlushed): 
Deleted.
(): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::setLayerRequiresFlush): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::applicationWillResignActive): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::applicationDidBecomeActive): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::enqueueSampleBuffer): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::configureVideoRenderer): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::invalidateVideoRenderer): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::stageVideoRenderer): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::videoRendererWillReconfigure): Deleted.
(WebCore::SourceBufferPrivateAVFObjC::videoRendererDidReconfigure): Deleted.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to