Repository navigation
fix(core): a sealed preview keeps a clip's picture while its lighter copy is made - #9006
Conversation
…othing is left to release
Edit accuracy: accurate 275 (base branch 273), smooth 57 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) Unstable (1)
|
|
Update at 3b5af22: main merged in, plus two commits after the review head.
Still sizes with the server's JPEG settings: 4K clips 0.33-1.0 MB, a 4K heavy-grain clip 5.3 MB, an 8K heavy-grain clip 21 MB; about 1.33x that as a data URL. The fetched bytes and Blob are freed once encoded. During the hold the string sits in the runtime's map and the poster attribute; both are cleared after the swap. A smaller still would come from the server making it at preview size, which is out of scope here. Render suites at 6bb6cf1: engine 3,784 passed; producer unit (vitest) 1,635 passed. |
terencecho
left a comment
There was a problem hiding this comment.
P2 — A clip can keep a large data-URL poster after its copy is served. Once makeCopy() calls loadProxy(), dropStill() waits for loadeddata or error. A clip can leave the page or abandon that media load without either event. If the page retains the element, the poster attribute and stillPosters retain the full encoded image. The new detach regression removes the clip while the copy is still pending, so it exercises the earlier !wanted branch. Please cover detachment after the copy is served and before it draws, and clear the runtime’s still when that load is abandoned while preserving a page-set poster.
The PR body also needs a fails without the fix: line naming the test on that line. The current heading lists tests beneath it. fetches the still and shows it from the answer, then drops it with the copy is already documented as a failing case.
— tai (automated review)
…another file A copy's still stood until the copy drew or failed. A clip that left the page, or was given another file, after its copy was served fired neither, so it kept the still (a sealed frame's full image) as its poster. The wait now also ends on an abort or emptied for another src, and when the clip leaves the page; a poster the page set is kept.
|
fails without the fix: fetches the still and shows it from the answer, then drops it with the copy fails without the fix: drops its still when the clip leaves the page after its copy is served (origin null) Update at 6d3e9f5, answering the change request at 3b5af22. After the copy is served, the still now drops on every way that load can end, not only when it draws or fails: an New tests, for both a sealed and an open frame: the clip leaves the page after its copy is served and before it draws; the clip gets another file before its copy draws (its own load's
|
terencecho
left a comment
There was a problem hiding this comment.
The poster cleanup addresses my previous finding. The new tests cover detachment and source replacement after the copy is served, and cover preserving a page-set poster. I reviewed the delta without rerunning the tests.
The remaining blocker is the PR description. Please put fails without the fix: drops its still when the clip leaves the page after its copy is served (origin null) on one line in the description. The author comment already has the evidence, and the description currently has the heading and test names on separate lines.
— tai (automated review)
terencecho
left a comment
There was a problem hiding this comment.
The head is unchanged at 6d3e9f53. The poster cleanup resolves my code finding, and the author's regression evidence satisfies the review requirement. I verified the evidence without rerunning the tests.
— tai (automated review)
What
In a sealed project preview (
sandbox-origin), a clip that is switching to a lighter copy keeps showing its own frame while the copy is made, as it already does in an open preview. Before, the clip's box went black (only the titles over it) for about 2 seconds.Why
When the preview steps its quality down, the runtime holds a clip off its file and sets the clip's poster to a still of the clip at the playhead (
hf-proxy-still) until the lighter copy is ready. After that reset the browser draws the poster, not the decoded frame, until the clip plays or seeks.In a sealed frame the browser did not send the poster's image request at all while the frame's copy request was waiting: in the request log it has no send time for the whole wait and is cancelled when the copy lands, about 2 s later. In an open frame the same request is sent at once and answers in about 50 ms. The server is not involved: stills run in their own job pool, and the same URL fetched from the sealed frame at the same moment is sent at once and answers in 44-48 ms.
Related work
None.
How
showStill(inpackages/core/src/runtime/mediaProxy.ts): in a sealed frame (window.origin === "null", the same testcolorGrading.tsuses for an opaque frame) it fetches the still and sets the poster to an object URL of the answer. An open frame sets the poster URL as before, unchanged.dropStillran or a newer still was asked for meanwhile, it is ignored.dropStillrevokes the object URL.fetchof any preview file withAccess-Control-Allow-Origin: null(opaqueFrameLoads.ts).Before
Sealed preview, a project with one video clip, frames at 1.8, 2.1, 2.4, 2.7 s (top row) and 3.0, 3.3, 3.6, 3.9 s (bottom row) after the click that opens it:
After
Same project, same frames:
Test plan
fails without the fix:
packages/core/src/runtime/mediaProxy.test.ts"in a sealed frame" › "fetches the still and shows it from the answer, then drops it with the copy" (fails on main: the poster is the still URL, not the fetched answer).Same block › "never shows a still that answers after its copy has landed" (fails when the hold check on the answer is removed) and "keeps a poster the page sets while the still is fetched" (fails on main and without the poster check on the answer).
"the still a copy waits behind" › "never puts its still back once dropped, when the copy draws only after seeking", for a sealed and an open frame (both fail on main and when the swap saves the runtime's still as the page's poster), and "keeps a poster the page sets while the copy is made" (fails on main and when dropping the still removes any poster).
packages/coremediaProxy.test.ts: 109/109, 3 runs in a row.Recorded on a Linux box (Xvfb, CPU throttled 4x), a desktop app built from these packages, the screen recorded at 60 fps. Measured: how long the clip's box shows no picture after the clip first appears. Rounds count only when the machine's load was at most 16 when they started.
The remaining ~70-120 ms in both modes falls when the clip swaps to the lighter copy. These rounds ran at the first commit; the second commit changes only which poster is put back after the swap, and two more rounds at the head follow in a comment.