Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 88039a970adb50d9cf382ea84903911eef45ce3c
      
https://github.com/WebKit/WebKit/commit/88039a970adb50d9cf382ea84903911eef45ce3c
  Author: Jean-Yves Avenard <[email protected]>
  Date:   2024-11-25 (Mon, 25 Nov 2024)

  Changed paths:
    M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h
    M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm

  Log Message:
  -----------
  VideoMediaSampleRenderer drops more frames than it should.
https://bugs.webkit.org/show_bug.cgi?id=283626
rdar://140515014

Reviewed by Eric Carlson.

Whenever we added a new video sample to the decoded queue we would call 
purgeDecodedSampleQueue()
which would re-schedule a run of purgeDecodedSampleQueue at the presentation 
end time of the same
at the top of the queue.
If we already had a pending schedule to display the next frame, that next frame 
would now never be displayed
and would be dropped on the next purgeDecodedSampleQueue() call.

We now only reschedule if we added a frame earlier than the next schedule.
Manually tested.

* Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h:
* Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm:
(WebCore::VideoMediaSampleRenderer::setTimebase):
(WebCore::VideoMediaSampleRenderer::decodedFrameAvailable):
(WebCore::VideoMediaSampleRenderer::maybeQueueFrameForDisplay): Record the time 
of the sample being displayed, and not the currentTime.
Otherwise it could lead to false negative and a frame could be enqueued more 
than once.
(WebCore::VideoMediaSampleRenderer::flushDecodedSampleQueue):
(WebCore::VideoMediaSampleRenderer::purgeDecodedSampleQueue):
(WebCore::VideoMediaSampleRenderer::maybeReschedulePurge): Added method, we 
only call purgeDecodedSampleQueue if no
schedule has been set, or if the video sample just added is earlier than the 
current set timer.
(WebCore::VideoMediaSampleRenderer::copyDisplayedPixelBuffer): When calling 
purgeDecodedSampleQueue, ensure than
it doesn't reschedule a call which could prevent displaying the next frame.

Canonical link: https://commits.webkit.org/287074@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