Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 865a4038f9b55dc407406bb12cc86ed190628477
      
https://github.com/WebKit/WebKit/commit/865a4038f9b55dc407406bb12cc86ed190628477
  Author: Jean-Yves Avenard <j...@apple.com>
  Date:   2024-11-20 (Wed, 20 Nov 2024)

  Changed paths:
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.h
    M Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm
    M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h
    M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm
    M Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.h
    M Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm

  Log Message:
  -----------
  requestVideoFrameCallback never calls its callback if the window is hidden.
https://bugs.webkit.org/show_bug.cgi?id=282797
rdar://139481527

Reviewed by Jer Noble.

Following-up on 286451@main, we continue duplicating the logic of maintaining a 
decoding queue from the
WebCoreDecompressionSession in VideoMediaSampleRenderer.
Rather than query if a sample has been presented by the 
AVSampleBufferDisplayLayer, we instead notify the MediaPlayerPrivate
when the sample has been decoded and added to the AVSBDL.

The need to use a separate WebCoreDecompressionSession whenever we do not have 
a render (such as the video being offscreen or a canvas being attached)
is no longer required thanks to the extended capabilities of the 
VideoMediaSampleRenderer which can now operates without a renderer being set.

This allows to greatly simplify the MediaPlayerPrivateWebM.

For now we restrict the changes to this player only, in a follow-up change we 
will use a similar approach with the MediaPlayerPrivateMediaSourceAVFObjC.

In additions the following changes were applied:
* Remove VideoMediaSampleRenderer::bounds() ; it can't be used with a 
renderer-less VideoMediaSampleRenderer.
* Always use a AVSampleBufferVideoRenderer on platforms supporting it when 
present.
  We can avoid the need to re-dispatch task on the main thread.
  On platforms not supporting it, we will enqueue compressed and decoded frames 
on the main thread instead.
  This will also allows the use with WK1 and compatible with web thread.
* Always use a decompression session if no renderer are available.
* When a AVSampleBufferVideoRenderer is used on two threads concurently, where 
on one thread we call stopRequestingMediaData and on the other we call 
enqueueMediaSample: a deadlock will occur.
  Workaround for rdar://139910776
* Access to m_decompressionSession was racy (could be deleted on the main 
thread while being used in the decoder queue
  For now, we don't allow disabling the decompression session if it's been 
setup already. pref can only be toggled until a sample has been submitted.

Re-enable tests that used to timeout.

* LayoutTests/platform/ios/TestExpectations:
* Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.h:
(WebCore::MediaPlayerPrivateWebM::decompressionSession const): Deleted.
* Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm:
(WebCore::MediaPlayerPrivateWebM::~MediaPlayerPrivateWebM):
(WebCore::MediaPlayerPrivateWebM::supportsType):
(WebCore::MediaPlayerPrivateWebM::updateLastPixelBuffer):
(WebCore::MediaPlayerPrivateWebM::videoFrameForCurrentTime):
(WebCore::MediaPlayerPrivateWebM::setHasAvailableVideoFrame):
(WebCore::MediaPlayerPrivateWebM::setPresentationSize):
(WebCore::MediaPlayerPrivateWebM::acceleratedRenderingStateChanged):
(WebCore::MediaPlayerPrivateWebM::updateDisplayLayer):
(WebCore::MediaPlayerPrivateWebM::enqueueSample):
(WebCore::MediaPlayerPrivateWebM::notifyClientWhenReadyForMoreSamples):
(WebCore::MediaPlayerPrivateWebM::isReadyForMoreSamples):
(WebCore::MediaPlayerPrivateWebM::didBecomeReadyForMoreSamples):
(WebCore::MediaPlayerPrivateWebM::trackDidChangeSelected):
(WebCore::MediaPlayerPrivateWebM::flushIfNeeded):
(WebCore::MediaPlayerPrivateWebM::flushVideo):
(WebCore::MediaPlayerPrivateWebM::registerNotifyWhenHasAvailableVideoFrame):
(WebCore::MediaPlayerPrivateWebM::startVideoFrameMetadataGathering):
(WebCore::MediaPlayerPrivateWebM::stopVideoFrameMetadataGathering):
(WebCore::MediaPlayerPrivateWebM::checkNewVideoFrameMetadata):
(WebCore::MediaPlayerPrivateWebM::playerContentBoxRectChanged):
(WebCore::MediaPlayerPrivateWebM::destroyLayerOrVideoRendererAndCreateRenderlessVideoMediaSampleRenderer):
(WebCore::MediaPlayerPrivateWebM::configureVideoRenderer):
(WebCore::MediaPlayerPrivateWebM::invalidateVideoRenderer):
(WebCore::MediaPlayerPrivateWebM::setVideoRenderer):
(WebCore::MediaPlayerPrivateWebM::stageVideoRenderer):
(WebCore::MediaPlayerPrivateWebM::setVideoTarget):
(WebCore::MediaPlayerPrivateWebM::isInFullscreenOrPictureInPictureChanged):
(WebCore::MediaPlayerPrivateWebM::updateDisplayLayerAndDecompressionSession): 
Deleted.
(WebCore::MediaPlayerPrivateWebM::ensureDecompressionSession): Deleted.
(WebCore::MediaPlayerPrivateWebM::destroyDecompressionSession): Deleted.
(WebCore::MediaPlayerPrivateWebM::videoRendererReadyForDisplayChanged): Deleted.
(WebCore::MediaPlayerPrivateWebM::destroyLayerOrVideoRenderer): Deleted.
* Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h:
(WebCore::VideoMediaSampleRenderer::timebase const): Deleted.
* Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm:
(WebCore::VideoMediaSampleRenderer::VideoMediaSampleRenderer):
(WebCore::VideoMediaSampleRenderer::timebase const):
(WebCore::VideoMediaSampleRenderer::isReadyForMoreMediaData const):
(WebCore::VideoMediaSampleRenderer::maybeBecomeReadyForMoreMediaData):
(WebCore::VideoMediaSampleRenderer::setTimebase):
(WebCore::VideoMediaSampleRenderer::enqueueSample):
(WebCore::VideoMediaSampleRenderer::decodeNextSample):
(WebCore::VideoMediaSampleRenderer::shouldDecodeSample):
(WebCore::VideoMediaSampleRenderer::initializeDecompressionSession):
(WebCore::VideoMediaSampleRenderer::decodedFrameAvailable):
(WebCore::VideoMediaSampleRenderer::flushCompressedSampleQueue):
(WebCore::VideoMediaSampleRenderer::cancelTimer):
(WebCore::VideoMediaSampleRenderer::flushDecodedSampleQueue):
(WebCore::VideoMediaSampleRenderer::purgeDecodedSampleQueue):
(WebCore::VideoMediaSampleRenderer::resetReadyForMoreSample):
(WebCore::VideoMediaSampleRenderer::copyDisplayedPixelBuffer):
(WebCore::VideoMediaSampleRenderer::totalVideoFrames const):
(WebCore::VideoMediaSampleRenderer::droppedVideoFrames const):
(WebCore::VideoMediaSampleRenderer::corruptedVideoFrames const):
(WebCore::VideoMediaSampleRenderer::totalFrameDelay const):
(WebCore::VideoMediaSampleRenderer::notifyWhenHasAvailableVideoFrame):
(WebCore::VideoMediaSampleRenderer::notifyHasAvailableVideoFrame):
(WebCore::VideoMediaSampleRenderer::ensureDecodedSampleQueue): Deleted.
* Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.h: Remove 
declaration for unused decodedFrameWhenAvailable method.
* Source/WebCore/platform/graphics/cocoa/WebCoreDecompressionSession.mm:
(WebCore::WebCoreDecompressionSession::decodeSample):
(WebCore::WebCoreDecompressionSession::decodedFrameWhenAvailable): Deleted. 
Method was unused.

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



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

Reply via email to