Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: ffb9c4a28c1adf98cc1e851b5502e6c1438d4a49
https://github.com/WebKit/WebKit/commit/ffb9c4a28c1adf98cc1e851b5502e6c1438d4a49
Author: Jean-Yves Avenard <[email protected]>
Date: 2025-10-31 (Fri, 31 Oct 2025)
Changed paths:
M LayoutTests/http/tests/media/fairplay/eme2016.js
A LayoutTests/http/tests/media/fairplay/fps-mse-video-mixed-expected.html
A LayoutTests/http/tests/media/fairplay/fps-mse-video-mixed.html
A LayoutTests/http/tests/media/resources/test-video.mp4
M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm
Log Message:
-----------
[MSE/EME] Video freezes on first frame when transitioning from encrypted to
clear (content to ad)
https://bugs.webkit.org/show_bug.cgi?id=301749
rdar://162234566
Reviewed by Jer Noble.
When VideoRendererUseDecompressionSessionForProtected preference is off (the
default
in user release), when first playing protected content, it will be
enqueued to an AVSampleBufferDisplayLayer directly.
When we switch to clear content, we switch to using a
WebCoreDecompressionSession
with an AVSampleBufferVideoRenderer.
When the switch from AVSBDL to WebCoreDecompressionSession occurs we would have
already enqueued several seconds of protected content (the AVSBDL allows
for some large buffer).
So the transition will occur several seconds in the future.
When calculating how much frames we should keep in our decoded queue to maintain
correct watermarks, we looked if we had decoded frames beyond currentTime +
100ms.
But the first decoded frame would be well ahead of that time. We incorrectly
determined that we had sufficient decoded video buffered and stopped decoding.
With the next waterlevel check being scheduled when we expire a frame, we never
resumed from that state and video would stall.
When calculating buffer level we now use the max(currentTime, nextFrame time)
to ensure our decoded buffer is always at least 100ms long even if well in the
future.
The tests didn't flag it as the problem only occurred if we had to transition
from an AVSBDL to a WebCoreDecompressionSession which doesn't happen when
VideoRendererUseDecompressionSessionForProtected preference is set (default in
tests).
Test: http/tests/media/fairplay/fps-mse-video-mixed.html
* LayoutTests/http/tests/media/fairplay/eme2016.js: Added options to remove
logging, necessary for doing a reftest.
* LayoutTests/http/tests/media/fairplay/fps-mse-video-mixed-expected.html:
Added.
* LayoutTests/http/tests/media/fairplay/fps-mse-video-mixed.html: Added.
* LayoutTests/http/tests/media/resources/test-video.mp4: Added ISOBMFF video.
* Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm:
(WebCore::VideoMediaSampleRenderer::decodeNextSampleIfNeeded): Move some
members declarations outside the loop, they don't need to be recalculated at
each iteration.
(WebCore::VideoMediaSampleRenderer::purgeDecodedSampleQueue): Add an additional
layer of safety by re-attempting a new decode if we have only one decoded frame
left in the queue.
Canonical link: https://commits.webkit.org/302409@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications