Repository navigation
fix(core): Safari keeps a small file's preload and leaves a playing clip's source alone - #7498
Conversation
df0f146 to
8830f0a
Compare
Edit accuracy: accurate 267 (base branch 267), smooth 112 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (1)
|
…ds a clip already playing
8830f0a to
0c17d91
Compare
…sed before the runtime The sweep sets preload none on them again and gives a clip its authored preload back once its file turns out not to be long.
f21f262 to
0981a75
Compare
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 1 important (follow-up) · 0 nits · head 0981a755
All three fails without the fix: claims hold. I removed each fix line on its own and ran preloadMedia.test.ts after each removal:
- Without the
notLongrestore (passingundefined), only "leaves the preload of a small file's clip parsed before the runtime as authored" fails. - Without the sweep's
preload="none"(later && !parsedEarly), only "holds a later clip of a long file parsed before the runtime" fails. This is the regression the real-Safari check caught. - Without the
pausedand!seekingchecks, only "does not hold a later clip that is already playing when its file's size arrives" fails.
At this head all 42 tests pass, and both CI runs for 0981a755 are green.
Important (not blocking): a playing clip is no longer held, but its source is still swapped mid-play. A clip that fails holdable goes on to openAtInPoint. For a clip that is playing, that call still rewrites src. I changed the playing-clip test to print what it ends with: /m/film-0.mp4#t=30. Setting src starts the load algorithm again, so a clip on screen is paused and sent back to its in-point. That is the fresh read the #7436 nit was about, reached by a different path. It is not a regression: main reaches openAtInPoint for a playing clip with networkState === 2, and it gave a held clip back at #t= on the next tick anyway. Suggested follow-up:
- In the
.then, return before both the hold andopenAtInPointwhen!el.paused || el.seeking(orel.readyState > 0, as the nit suggested; metadata is already loaded by then, so the in-point open gains nothing). - Make the test assert that
srcis unchanged, rather than onlynot.toBeNull().
Scope
I read the full preloadMedia.ts at this head. notLong only runs for later clips the sweep parsed early, so clips the observer sees arrive keep preload="none", as on main. A failed size read (bytes === null) and the not-in-player path both restore the authored preload, which matches main for those clips. A long file whose src changed before the size answer stays at none, as before. I did not repeat the Safari audio-seek measurement; the Player Safari audio job is green at this head.
…y playing or seeking Its file's size can arrive after the clip started; writing an in-point src then restarted its load and sent it back to the in-point.
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 nits · head e75d831f
The important finding from 0981a755 is fixed. A long file's clip that is playing or seeking now returns before both the hold and openAtInPoint, so its src is never rewritten. The tests now assert that src is unchanged, not just that it is not null. I checked the fails without the fix: claim one check at a time:
- Without
!el.paused, only "leaves the src of a later clip already playing when its file's size arrives" fails. - Without
el.seeking, only "… already seeking …" fails.
At this head all 43 tests in preloadMedia.test.ts pass. The other three fix tests from my review at 0981a755 are unchanged.
CI: the first CI run at this head failed only in Producer: unit tests, with one test each in renderOrchestrator.videoFrameWindow.test.ts and renderOrchestrator.stall.test.ts (6.8 s and 6.6 s files). This PR does not touch producer code, and the rerun on the same SHA passed. Every other workflow, including Player Safari audio and perf, is green.
Scope
The change since 0981a755 touches only preloadMedia.ts and its test. Moving the paused/seeking check out of holdable and into the early return also skips opened() for a playing clip, so that clip's preload stays none. That has no effect, because the clip is already loading.
What
Follow-up to #7436. Fixes the two review notes on #7436: on Safari, a small file's clip parsed before the runtime keeps its authored preload, and a clip of a long file that is already playing or seeking keeps its source when its file's size arrives.
Why
preload="none"on every later clip, before it knew the file's size. A clip of a small file, which the long-file path never touches, then lost the preload its author wrote. On main it keeps it.srcrewritten to#t=<in-point>, which restarts its load and sends a clip on screen back to its in-point.Two further changes for the head re-read and the late first sound were measured on this branch and taken out, since neither helped in the Simulator measure. They come back only with a measured win.
Size
54 changed lines, standing alone on purpose: these are the review follow-ups to #7436, which has already merged, so no open PR can carry them. Each fix comes with the test that fails without it.
Related work
Refs #7436.
How
deferMediaUntilDue's sweep over already-parsed clips still sets a later clip topreload="none", so a long file's later clip is held as before. Once the size check says the file is not long (or the page is outside the player), the clip gets its authored preload back. Clips the observer sees arrive keeppreload="none", as on main.openLongSourceAtInPoint(preloadMedia.ts) leaves a clip that is playing or seeking alone, before both the hold and the in-point open.Test plan
preloadMedia.test.ts: "leaves the preload of a small file's clip parsed before the runtime as authored", "holds a later clip of a long file parsed before the runtime", "leaves the src of a later clip already playing / seeking when its file's size arrives" (asserts thesrcis unchanged).preload="none"(second), and the playing check and the seeking check (one case each of the third).preloadMedia,init.longSourceHold,init,mediaProxyandmediatest files on main plus this change: 596 of 596 pass, 3 runs in a row.preload="none"on a long file's parsed clips too, so they were opened at their in-points instead of held, and the ten-take edit reached 15 to 16 audio seeks against a limit of 15 (9 to 13 on main). The second test covers it.