Bug 270050
| Summary: | MSE player will have readyState oscillate between readyState = HAVE_CURRENT_DATA and HAVE_ENOUGH_DATA | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Jean-Yves Avenard [:jya] <jean-yves.avenard> |
| Component: | Media | Assignee: | Jean-Yves Avenard [:jya] <jean-yves.avenard> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=265023 | ||
Jean-Yves Avenard [:jya]
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/123597692>
Jean-Yves Avenard [:jya]
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]
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]
Pull request: https://github.com/WebKit/WebKit/pull/25083
EWS
Committed 275348@main (747f80b0591c): <https://commits.webkit.org/275348@main>
Reviewed commits have been landed. Closing PR #25083 and removing active labels.