Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9928bbc3693acd073a77d5843aca83a25f75c3c2
      
https://github.com/WebKit/WebKit/commit/9928bbc3693acd073a77d5843aca83a25f75c3c2
  Author: Jean-Yves Avenard <j...@apple.com>
  Date:   2024-11-19 (Tue, 19 Nov 2024)

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

  Log Message:
  -----------
  [WebM] video freeze after about 2s.
https://bugs.webkit.org/show_bug.cgi?id=283360
rdar://140197940

Reviewed by Eric Carlson.

The CMSampleBufferQueue used to store the decoded frames and re-order them by 
presentation time
has a maximum capacity of 120 frames.
When playing a 60fps video, it would take just 2s before decoded frames were 
dropped.

We limit the total number of compressed+decoded frames to determine if we 
should stop accepting more data.

Fly-By: the time at which we would schedule a frame to be displayed was always 
the
end of the frame. If there was a gap between the frame, the frame following the 
gap wouldn't be displayed.
So instead, we set the next timer to be either the start of the frame if 
there's a gap, or its end.

Manually tested. Writing a test is problematic. Issue would have occurred on 
machine fast enough to decode
data before we had the time finishing processing the compressed queue and for 
the video to be long enough to
fully fill the decoding queue.

* Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h:
* Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm:
(WebCore::VideoMediaSampleRenderer::decodedSamplesCount const):
(WebCore::VideoMediaSampleRenderer::isReadyForMoreMediaData const):
(WebCore::VideoMediaSampleRenderer::areSamplesQueuesReadyForMoreMediaData 
const):
(WebCore::VideoMediaSampleRenderer::queueMaybeBecomeReadyForMoreMediaData 
const): Add convenience method to call maybeBecomeReadyForMoreMediaData on the 
main thread.
(WebCore::VideoMediaSampleRenderer::maybeBecomeReadyForMoreMediaData): If the 
renderer isn't ready for data and a decompression session is used set a request 
callback to call maybeBecomeReadyForMoreMediaData once it is available.
(WebCore::VideoMediaSampleRenderer::setTimebase):
(WebCore::VideoMediaSampleRenderer::decodeNextSample):
(WebCore::VideoMediaSampleRenderer::initializeDecompressionSession):
(WebCore::VideoMediaSampleRenderer::decodedFrameAvailable):
(WebCore::VideoMediaSampleRenderer::purgeDecodedSampleQueue):
(WebCore::VideoMediaSampleRenderer::flush):
(WebCore::VideoMediaSampleRenderer::resetReadyForMoreSample):
(WebCore::VideoMediaSampleRenderer::copyDisplayedPixelBuffer):
(WebCore::VideoMediaSampleRenderer::ensureDecodedSampleQueue): Deleted.

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