Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b15a127ad26331c22771febc364d671b10872729
https://github.com/WebKit/WebKit/commit/b15a127ad26331c22771febc364d671b10872729
Author: Jean-Yves Avenard <[email protected]>
Date: 2025-05-24 (Sat, 24 May 2025)
Changed paths:
M Source/WebCore/platform/graphics/SourceBufferPrivate.cpp
M Source/WebCore/platform/graphics/SourceBufferPrivate.h
M Source/WebCore/platform/graphics/TrackBuffer.cpp
M Source/WebCore/platform/graphics/TrackBuffer.h
M
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h
M
Source/WebCore/platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm
M Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.h
M Source/WebCore/platform/graphics/cocoa/MediaPlayerPrivateWebM.mm
M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.h
M Source/WebCore/platform/graphics/cocoa/VideoMediaSampleRenderer.mm
M Source/WebCore/platform/graphics/cocoa/WebSampleBufferVideoRendering.h
M Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.cpp
M Source/WebCore/platform/mock/mediasource/MockSourceBufferPrivate.h
Log Message:
-----------
VideoMediaSampleRenderer can enqueue sample with a presentation time lower
than the last calculated minimum time
https://bugs.webkit.org/show_bug.cgi?id=293422
rdar://151850145
Reviewed by Jer Noble.
We stop attempting to determine the minimum upcoming time from the
VideoMediaSampleRenderer's compressed queue.
If the number of pending samples drop below a certain threshold (such as would
occur if
decoding was faster than it takes the SourceBuffer to enqueue them), the
renderer would
incorrectly determine that the minimum time.
This would cause the future samples to be added after we notified the
AVSampleBufferVideoRenderer on what the
expectMinimumUpcomingSampleBufferPresentationTime
was going to be.
So instead, we calculate this in the TrackBuffer which is the source of truth.
We also now always calculate such value as samples are added and removed
from the TrackBuffer so that the minimum value is always known.
Whenever a new sample is enqueued to the VideoMediaSampleRenderer we also
provide the minimum time of the upcoming samples. This value can be used
to determined if we need to decode further samples, or when to notify
the AVSampleBufferVideoRenderer of the next upcoming time.
No change in existing, observable behaviour. Covered by existing tests.
Added debug assertions that caused existing tests to crash without the fixes
contained in this patch.
* Source/WebCore/platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::minimumUpcomingPresentationTimeForTrackID): Add
convenience method so that child classes
can access the minimumUpcomingPresentationTime without having access to the
TrackBuffer. An alternative
would have been to pass this value all the way down to enqueueSample but this
would have resulted in a much bigger change.
(WebCore::SourceBufferPrivate::updateMinimumUpcomingPresentationTime): We no
longer need to explictly recalculate the value
as it is now kept up to date as samples are added or removed from the
TrackBuffer.
(WebCore::SourceBufferPrivate::minimumUpcomingPresentationTimeForTrackID):
Deleted.
(WebCore::SourceBufferPrivate::clearMinimumUpcomingPresentationTime): Deleted.
* Source/WebCore/platform/graphics/TrackBuffer.cpp:
(WebCore::TrackBuffer::addSample): incrementally re-calculate
m_minimumEnqueuedPresentationTime if a sample
was also added to the end of the decode queue.
(WebCore::TrackBuffer::nextSample): same as above.
(WebCore::TrackBuffer::updateMinimumUpcomingPresentationTime): Convenience
method.
The only codecs using out of order frames (b-frames) are H264 and HEVC and a
frame
can only reference another in a window of samples that is 16-large. We can limit
the scan to a maximum of 16 samples.
(WebCore::MediaPlayerPrivateWebM::clearMinimumUpcomingPresentationTime):
Deleted.
(WebCore::VideoMediaSampleRenderer::hasIncomingOutOfOrderFrame const): Deleted.
(WebCore::VideoMediaSampleRenderer::minimumUpcomingSampleTime const): Deleted.
(WebCore::VideoMediaSampleRenderer::resetUpcomingSampleBufferPresentationTimeExpectations):
Deleted.
(WebCore::MockSourceBufferPrivate::minimumUpcomingPresentationTimeForTrackID):
Deleted.
(WebCore::MockSourceBufferPrivate::setMinimumUpcomingPresentationTime): Deleted.
(WebCore::MockSourceBufferPrivate::clearMinimumUpcomingPresentationTime):
Deleted.
Canonical link: https://commits.webkit.org/295388@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