Repository navigation
fix(core): stop the preview waiting forever on a clip that gets no data - #5
Draft
robinebers wants to merge 1 commit into
Draft
robinebers wants to merge 1 commit into
robinebers wants to merge 1 commit into
Conversation
The film holds while a clip it needs has no data, and it held for good when that data never came. On a page that loads every clip at parse, Chrome and Firefox keep each paused clip's request open with its unread bytes. Those requests fill the connection's window, and the request for the clip the film waits on is never answered. The stall rule in isUnplayable does not catch this clip: it reports readyState 1 while still loading. After 5 s with no change in the held clips' readyState or buffered time, the runtime now releases every clip outside the current window that holds a request, at preload none, which frees the connection. Each one loads again when it comes due. To reproduce: open a composition of 37 clips cut from a 363 MB and a 180 MB .mov served over HTTP/3 on its own, without the player. In Chrome it stops at 0:17 and never moves again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
When the preview waits for a clip's data, it shows Buffering and holds the film. If that data never arrives, the film waits forever.
This happens on a composition page opened on its own, outside the player. That page loads every clip at once, and in Chrome and Firefox the open downloads fill the connection, so the request for the clip the film needs is never answered. The film from the freeze fix (#4) stops this way at 0:17 and is still stopped four minutes later.
What
If the film has waited 5 seconds and the clip it needs has received nothing new, the preview lets go of every clip that is not on screen. Their downloads end, the connection frees up, and the waiting clip's data arrives. The clips it let go of load again when they come up. A clip that loads slowly but still receives data is waited for as before.
Test plan
The test film from #4 (2:16, 37 clips cut from two long .mov files served over HTTP/3), opened directly as a page without the player, headless:
Unit tests.
init.buffering.test.tshas two new tests:The first fails without this change. The core suite, runtime CI and typecheck pass locally.
Unit tests added/updated
Manual testing performed
Documentation updated (if applicable): no docs describe this behaviour
Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug
Related work
Stacked on #4. In Firefox, releasing a clip relies on that PR's release fix; without it, Firefox fetches metadata for every clip it lets go of. Upstream, open it after #4's change lands.
How
readyStateand buffered seconds. After 5 s with no change, it releases every clip outside the current window that holds a request (anyreadyStateabove 0, or still loading) atpreload="none", and keeps waiting. If nothing changes, it repeats every 5 s.isUnplayableuses for a clip stalled since its first play request. That rule misses this clip, which reportsreadyState1 while still loading.