Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 26464484bd534565e631ce3ea7e9ac56dae1138a
https://github.com/WebKit/WebKit/commit/26464484bd534565e631ce3ea7e9ac56dae1138a
Author: Jean-Yves Avenard <[email protected]>
Date: 2026-07-20 (Mon, 20 Jul 2026)
Changed paths:
A
LayoutTests/media/media-source/media-source-evict-ignorable-gap-expected.txt
A LayoutTests/media/media-source/media-source-evict-ignorable-gap.html
M LayoutTests/platform/glib/TestExpectations
M Source/WebCore/platform/graphics/MediaSourcePrivate.cpp
M Source/WebCore/platform/graphics/MediaSourcePrivate.h
M Source/WebCore/platform/graphics/SourceBufferPrivate.cpp
Log Message:
-----------
[MSE] Don't evict playable data across gaps small enough to bridge during
playback
https://bugs.webkit.org/show_bug.cgi?id=319584
rdar://182414037
Reviewed by Jer Noble.
The coded frame eviction algorithm (phase 2, past currentTime) protected the
buffered segment the playhead was in and only evicted data after it. It worked
out that segment with a raw TimeRanges::find(), which treated every sub-range
boundary as the end of the segment.
Since we loosened the gap tolerance during playback in 316146@main, playback
now plays
straight through small gaps (<= 125ms, or 250ms when audio covers them), so a
buffer like [0,2][2.1,5] is really one playable run. But find() still saw two
ranges, so eviction (and evictableSize) happily trimmed into [2.1,5] — throwing
away data the player would have reached without stalling. In other cases the
same logic bailed out early and left evictable data behind.
Fix it by asking where playback would actually stall. Added a nextStallTime()
overload that walks a given set of ranges, bridging gaps the same way the gap
policy does, and use it in both evictFrames() and computeEvictionData() against
this SourceBuffer's own buffered ranges. We now protect everything up to the
next real stall and only evict past it. When currentTime isn't buffered there's
no segment to protect, so we keep the previous "currentTime + timeChunk"
look-ahead.
Note this is evaluated per-SourceBuffer, so in the multi-track case we may keep
a bit more than strictly necessary (a gap this track bridges that another track
doesn't), but we never truncate data this track can play through.
Test: media/media-source/media-source-evict-ignorable-gap.html
* LayoutTests/media/media-source/media-source-evict-ignorable-gap-expected.txt:
Added.
* LayoutTests/media/media-source/media-source-evict-ignorable-gap.html: Added.
* Source/WebCore/platform/graphics/MediaSourcePrivate.cpp:
(WebCore::MediaSourcePrivate::nextStallTime const):
* Source/WebCore/platform/graphics/MediaSourcePrivate.h:
* Source/WebCore/platform/graphics/SourceBufferPrivate.cpp:
(WebCore::SourceBufferPrivate::computeEvictionData):
(WebCore::SourceBufferPrivate::evictFrames):
Canonical link: https://commits.webkit.org/317602@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications