Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: d33874653d6bf47bba4b9fca76ad6ac8e34b3928 https://github.com/WebKit/WebKit/commit/d33874653d6bf47bba4b9fca76ad6ac8e34b3928 Author: Jean-Yves Avenard <j...@apple.com> Date: 2024-11-27 (Wed, 27 Nov 2024)
Changed paths: M LayoutTests/media/media-rvfc-paused-mp4-expected.txt M LayoutTests/media/media-rvfc-paused-mp4.html M LayoutTests/media/media-rvfc-paused-offscreen-mp4-expected.txt M LayoutTests/media/media-rvfc-paused-offscreen-mp4.html M LayoutTests/media/media-rvfc-paused-offscreen-webm-expected.txt M LayoutTests/media/media-rvfc-paused-offscreen-webm.html M LayoutTests/media/media-rvfc-paused-webm-expected.txt M LayoutTests/media/media-rvfc-paused-webm.html M Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp M Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm Log Message: ----------- VideoMediaSampleRenderer do not display decoded frames that have no duration set. https://bugs.webkit.org/show_bug.cgi?id=283677 rdar://140538938 Reviewed by Youenn Fablet. Do not use CMSampleBuffer's duration to determine when to schedule the next frame for display or to purge the decoded queue from late frames. The decoded sample returned by WebCodec's VideoDecoder all have a duration set to 0. Their presentation time is equal to their presentation end time. When we scheduled the task to purge old frames, it would then attempt to display the earliest frame which would either always be - too late - not ready for display yet. In this change, we now always assume a decoded frame is to be displayed until the next one is available (provided it's not already late by the time the decoding completed). We ignore the duration set in the decoded queue's CMSampleBuffer and instead always use the start time of the next frame to determine the duration of the previous one. Covered by existing tests and further tests enabled in a follow-up change (webkit.org/b/282163) * LayoutTests/media/media-rvfc-paused-mp4-expected.txt: Make seeked event silent as it can happen to be fired after the rVFC promise is resolved. * LayoutTests/media/media-rvfc-paused-mp4.html: * LayoutTests/media/media-rvfc-paused-offscreen-mp4-expected.txt: * LayoutTests/media/media-rvfc-paused-offscreen-mp4.html: * LayoutTests/media/media-rvfc-paused-offscreen-webm-expected.txt: * LayoutTests/media/media-rvfc-paused-offscreen-webm.html: * LayoutTests/media/media-rvfc-paused-webm-expected.txt: * LayoutTests/media/media-rvfc-paused-webm.html: * Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp: * Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h: Add soft-link to CMBufferQueueCallForEachBuffer. * Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h: The timebase and TimerSource should only ever be accessed atomically together. Change the type to better reflect this by using a std::pair to store both. * Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm: (WebCore::VideoMediaSampleRenderer::nextDecodedSample const): code was used in multiple place. Move it to a dedicated function. (WebCore::sampleCallback): (WebCore::VideoMediaSampleRenderer::nextDecodedSampleEndTime const): Add method that interates the CMBufferQueue and stops after the 2nd frame. (WebCore::VideoMediaSampleRenderer::enqueueDecodedSample): (WebCore::VideoMediaSampleRenderer::setTimebase): (WebCore::VideoMediaSampleRenderer::clearTimebase): (WebCore::VideoMediaSampleRenderer::timebaseAndTimerSource const): (WebCore::VideoMediaSampleRenderer::timebase const): (WebCore::VideoMediaSampleRenderer::enqueueSample): Notify player that we are ready for more data when clearing the compressed frame queue (WebCore::VideoMediaSampleRenderer::decodeNextSample): Notify player that we are ready for more data as soon as we pop a frame from the compressed queue. (WebCore::VideoMediaSampleRenderer::decodedFrameAvailable): (WebCore::VideoMediaSampleRenderer::maybeQueueFrameForDisplay): (WebCore::VideoMediaSampleRenderer::flushDecodedSampleQueue): (WebCore::VideoMediaSampleRenderer::cancelTimer): (WebCore::VideoMediaSampleRenderer::purgeDecodedSampleQueueAndDisplay): (WebCore::VideoMediaSampleRenderer::purgeDecodedSampleQueue): (WebCore::VideoMediaSampleRenderer::schedulePurgeAndDisplayAtTime): (WebCore::VideoMediaSampleRenderer::maybeReschedulePurgeAndDisplay): Check if we need to reschedule a new purge&display if the latest frame added is more recent than the last one. Handle the case where we added a new frame with infinite duration (the last frame), in which case we see if it needs to be displayed immediately. (WebCore::VideoMediaSampleRenderer::copyDisplayedPixelBuffer): (WebCore::VideoMediaSampleRenderer::maybeReschedulePurge): Deleted. Canonical link: https://commits.webkit.org/287133@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