RESOLVED FIXED 270050
MSE player will have readyState oscillate between readyState = HAVE_CURRENT_DATA and HAVE_ENOUGH_DATA
https://bugs.webkit.org/show_bug.cgi?id=270050
Summary MSE player will have readyState oscillate between readyState = HAVE_CURRENT_D...
Jean-Yves Avenard [:jya]
Reported 2024-02-25 07:54:05 PST
This is a regression due to bug 265023 and change in 272762@main The change made it assume that if we have 3s of data buffered, then we can switch to readyState = HAVE_ENOUGH_DATA The change was incorrect in multiple ways: 1- In only checks that we have buffered data past currentTime + 3s [1] 2- it doesn't check that we have 3s ahead but just 2, as it always removes 1s to the time ahead [2] 3- the MockMediaSourcePlayer doesn't play the data as such, it simply skips to the end of the next buffered range gap. And so will quickly go from readyState HAVE_ENOUGH_DATA to HAVE_CURRENT_DATA and so change made to check the readyState in media-source-monitor-playing-event.html makes it racy [3] This is making media/media-source/media-source-monitor-playing-event.html [1] https://searchfox.org/wubkat/rev/d102bc345038f90db9ed1f3d16c42f4843f33f7c/Source/WebCore/Modules/mediasource/SourceBuffer.cpp#1304 [2] https://searchfox.org/wubkat/rev/d102bc345038f90db9ed1f3d16c42f4843f33f7c/Source/WebCore/Modules/mediasource/SourceBuffer.cpp#1302 [3] https://searchfox.org/wubkat/rev/d102bc345038f90db9ed1f3d16c42f4843f33f7c/LayoutTests/media/media-source/media-source-monitor-playing-event.html#88
Attachments
Radar WebKit Bug Importer
Comment 1 2024-02-25 07:54:12 PST
Jean-Yves Avenard [:jya]
Comment 2 2024-02-25 07:56:49 PST
Addition to point 1: the test doesn't check that we have *continuous* data, just that we have buffered data in the future. so if currentTime = 10 and we have a buffered range of: [0, 10] [20, 30] readyState will be HAVE_ENOUGH_DATA, when playback would have stalled.
Jean-Yves Avenard [:jya]
Comment 3 2024-02-25 08:39:56 PST
I see which code was copied from Firefox and where the error comes from: https://searchfox.org/mozilla-central/source/dom/media/mediasource/MediaSourceDecoder.cpp#322 The logic in Firefox is broken too since https://searchfox.org/mozilla-central/diff/0412867c82b28b519898f8819a2ffe1614fa8ed0/dom/media/mediasource/MediaSourceDecoder.cpp#307 The original Firefox logic properly ensured that we had 3s of contiguous data allows only gaps of 250ms https://searchfox.org/mozilla-central/rev/66362e5e967addc30c932be903fc75b6f6f75968/dom/media/mediasource/MediaSourceDecoder.cpp#296 (incidentally I was the author of that earlier version)
Jean-Yves Avenard [:jya]
Comment 4 2024-02-25 20:25:30 PST
EWS
Comment 5 2024-02-26 14:26:24 PST
Committed 275348@main (747f80b0591c): <https://commits.webkit.org/275348@main> Reviewed commits have been landed. Closing PR #25083 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.