WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
287709
[MSE] WebKit may lose text samples after removal of video ranges
https://bugs.webkit.org/show_bug.cgi?id=287709
Summary
[MSE] WebKit may lose text samples after removal of video ranges
Alicia Boya García
Reported
2025-02-14 10:17:12 PST
When using text tracks in MSE, cues are meant to be available in the DOM immediately after doing appendBuffer(). Also, if a time range containing cues is removed with SourceBuffer.remove(), we would expect those cues to no longer be available in the DOM. I was trying to figure out how this works, and the only place I could find where specific ranges of cues are removed as a consequence of a MSE remove() is in HTMLMediaElement::mediaPlayerBufferedTimeRangesChanged(): ``` for (unsigned i = 0; i < m_textTracks->length(); ++i) { Ref track = *m_textTracks->item(i); if (!track->shouldPurgeCuesFromUnbufferedRanges()) continue; track->removeCuesNotInTimeRanges( #if ENABLE(MEDIA_SOURCE) m_mediaSource ? m_mediaSource->buffered() : #endif m_player->buffered()); } ``` This code is problematic because it conflates the buffered ranges of the track with the buffered ranges of the MediaSource. Imagine the following sequence of actions: 1. Create a MediaSource with two SourceBuffers: one for video and one for text. 2. videoSb.appendBuffer(videoInitSegment); 3. textSb.appendBuffer(textInitSegment); 4. videoSb.appendBuffer(videoMediaSegment); 5. textSb.appendBuffer(textMediaSegment); 6. videoSb.remove(0, 10); 7. videoSb.appendBuffer(videoMediaSegment); Since the SourceBuffer responsible for the text track never received a remove(), you would expect that after that sequence of actions the cues would still be available. However, since the buffered ranges of a MediaSource are the intersection of the the buffered ranges of the TrackBuffers, the buffered ranges of the MediaSource would change after action (6), after which the above code would delete the cues, and unless I'm missing anything there is no way they could be re-added after (7). The sequence of actions I wrote above is not particularly exotic: a user-requested change in resolution could easily trigger that sequence of actions.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2025-02-21 10:18:14 PST
<
rdar://problem/145301735
>
Eric Carlson
Comment 2
2025-02-21 17:10:50 PST
Pull request:
https://github.com/WebKit/WebKit/pull/41115
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug