Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 70e442b8b1ce7784fc7c7c29ea6ca784e020aea3
https://github.com/WebKit/WebKit/commit/70e442b8b1ce7784fc7c7c29ea6ca784e020aea3
Author: Jean-Yves Avenard <[email protected]>
Date: 2026-04-27 (Mon, 27 Apr 2026)
Changed paths:
M LayoutTests/platform/mac-wk2/TestExpectations
M Source/WebCore/platform/graphics/avfoundation/AudioVideoRendererAVFObjC.h
M Source/WebCore/platform/graphics/avfoundation/AudioVideoRendererAVFObjC.mm
M
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
M
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h
M
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
M Tools/TestWebKitAPI/Tests/WebCore/cocoa/AudioVideoRendererAVFObjCTests.mm
Log Message:
-----------
REGRESSION(311771@main): [Tahoe] media/media-vp8-webm-with-preload.html is a
flaky TEXT failure
https://bugs.webkit.org/show_bug.cgi?id=313352
rdar://175625798
Reviewed by Jer Noble.
The test expects readyState to remain at HAVE_METADATA for 500ms when
preload="metadata", but sometimes observed HAVE_ENOUGH_DATA.
The regressing commit added a switchingFromRenderless condition in
stageVideoRenderer that triggered notifyRequiresFlushToResume during
initial renderer setup, even when no video sample had ever been enqueued.
This flush caused the WebM player to re-enqueue video samples to the
renderer, accelerating the first frame decode and advancing readyState
within the test's 500ms window.
However, 311771@main only fixed the video-disappearing-on-tab-switch bug
incidentally. The real issue was that
SourceBufferPrivateAVFObjC::maybeUpdateNeedsVideoLayer did not notify
the player when m_needsVideoLayer changed, causing
setHasProtectedVideoContent to remain false even when encrypted content
was being decoded. This meant canUseDecompressionSession() incorrectly
returned true for protected content, allowing the renderer to be torn
down on tab switch. The decompression session could not handle the
protected content, leaving the renderer empty on restore.
switchingFromRenderless masked this by forcing a flush on restore.
Fixed by:
- Making maybeUpdateNeedsVideoLayer notify the player when the value
changes, ensuring setHasProtectedVideoContent is set correctly. The
renderer now stays during tab switch for protected content, and the
platform callback handles the flush when needed.
- Removing redundant needsVideoLayerChanged calls from
cdmInstanceAttached/cdmInstanceDetached (neither changes
m_protectedTrackID or the enabled track state) and from
didProvideContentKeyRequestInitializationDataForTrackID (now handled
by maybeUpdateNeedsVideoLayer).
- Moving m_protectedTrackID assignment outside the LEGACY_ENCRYPTED_MEDIA
guard so it is set for all encrypted media paths.
- Simplifying RendererConfiguration to a single isRenderingCompressedVideo
field that captures when a flush is actually needed: when compressed
video was being sent to the platform renderer (not using a
decompression session) and that renderer configuration changed.
- Adding m_hasEverSubmittedVideoSample to prevent flush during initial
renderer setup before any sample has been enqueued.
- Eliminating the switchingFromRenderless workaround and the separate
videoTrackChangeOnly, configurationChanged, hasVideoTrack,
canUseDecompressionSession, and isProtected tracking variables.
* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebCore/platform/graphics/avfoundation/AudioVideoRendererAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/AudioVideoRendererAVFObjC.mm:
(WebCore::AudioVideoRendererAVFObjC::enqueueSample):
(WebCore::AudioVideoRendererAVFObjC::configureHasAvailableVideoFrameCallbackIfNeeded):
(WebCore::AudioVideoRendererAVFObjC::stageVideoRenderer):
(WebCore::AudioVideoRendererAVFObjC::flushVideo):
*
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
*
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
(WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
(WebCore::SourceBufferPrivateAVFObjC::maybeUpdateNeedsVideoLayer):
* Tools/TestWebKitAPI/Tests/WebCore/cocoa/AudioVideoRendererAVFObjCTests.mm:
Canonical link: https://commits.webkit.org/312161@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications