Repository navigation
fix(core): at full quality a 4K clip plays a copy at the size the preview shows it - #7723
Merged
Merged
Conversation
Contributor
Edit accuracy: accurate 267 (base branch 267), smooth 114 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (1)
|
Contributor
There was a problem hiding this comment.
Verdict: REQUEST CHANGES · 2 blocker · 0 important · 0 nits · head 65ca9f8b
- blocker — the body has no
fails without the fix:line. This lane requires one on fix PRs, naming a test that fails without the fix. "Each test was shown to fail without its code" lists counts, not a named test. Add, for example,fails without the fix: mediaProxy.test.ts › at full quality… › never loads the file while its copy is made…. - blocker — a failed copy undoes #7679's idle hold for exactly the oversized clips this PR targets. ↓ inline
Scope
Read all 5 files. The 5 test files in the body pass locally (382/382), and all CI runs on this head passed. The copy-served path, the level-drop path and the giveBackWhenDue skip behave as the body describes. I checked the failure finding with probe tests run against this head and against main.
…oder is still freed when idle
Contributor
There was a problem hiding this comment.
Verdict: REQUEST CHANGES — 2 resolved, 0 open, 1 new · 65ca9f8 → 2c16f19
- blocker — required
Buildis red in both runs on this head.verify:packed-manifestsreports "@hyperframes/core unpacked size 4373870 bytes is over its budget of 4330000 by more than 1%" (the limit is 4,373,300 bytes, so it is 570 bytes over).mainpasses. Raise core's entry inscripts/package-size-budgets.jsonand give the reason in the body.
…e its size budget
This was referenced Nov 14, 2026
Merged
This was referenced Nov 23, 2026
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.
What
At full preview quality, a video with at least twice the pixels the preview shows it at (a 4K take in a 1080p-or-smaller preview) now plays a copy made at the size it is shown. Until that copy is ready, the clip shows a still frame and never loads its original. Below full quality nothing changes, except that an oversized file is held the same way while its lighter copy is made. Render and export never use copies, as before.
Why
A preview of many 4K takes ran the renderer out of memory. Each clip near the playhead decoded its original at 3840x2160 to show it at about a quarter of that. Lighter copies existed only below full quality, and even there the original kept decoding until its copy arrived, so opening such a project spiked memory before any copy landed.
Related work
Builds on #7679, which frees a clip's decoder once the playhead leaves it. This change addresses the clips that are near the playhead.
How
previewProxyBox.ts:wantsLighterCopy(facts, box, level)is the one rule for when a copy is made. Below full quality it is the existingisHeavyForPreview. At full quality it is onlyisOversizedForPreview, the pixel share, so a 10-bit, HDR or high-bitrate source that is not oversized keeps its own look.mediaProxy.ts: the proactive path andsetPreviewQualityapply that rule at every level, andkeepSizedasks it too, so going back to full quality keeps a copy only while the file is still oversized for its box. While the copy of an oversized file is made,holdForCopyrecords the authored src (readers still see the file), removes the src, asks for the existing server still at the playhead on each poll, and holds frame captures up to the existingHOLD_CAP_MS. If the copy cannot be made, or the wait ends for any other reason, the hold ends as it found the clip: one the preload held until due stays held (giveBackWhenDuebrings it back), any other gets its src back with its in-point record, so fix(core): free a preview clip's decoder when the playhead leaves it #7679's idle hold still frees it.mediaProxy.tsholds and ends the hold (holdForCopy,endCopyHold);proxySrc.tsonly shares the state (heldForCopy,inPointOf), andgiveBackWhenDueinpreloadMedia.tsskips a clip inheldForCopy, so the near-playhead path does not load the file the hold just stopped.Test plan
Unit tests, run one file at a time:
src/runtime/mediaProxy.test.ts: 81 of 81 pass.src/runtime/preloadMedia.test.ts: 43 of 43 pass.src/runtime/entry.test.ts: 57 of 57 pass.src/runtime/media.test.ts: 195 of 195 pass.src/previewProxyBox.test.ts: 8 of 8 pass.New tests at full quality:
Three existing tests that asserted "full quality never makes a copy" now use files that are not oversized at that box.
fails without the fix:
mediaProxy.test.ts> at full quality, a file with at least twice the pixels it shows > never loads the file while its copy is made, and plays a copy at the shown box (with the hold removed the file keeps its src); and > stays held until due when its copy fails, as it was before the copy (with the old give-back the not-due clip gets/video.mp4back).Each test was shown to fail without its code:
giveBackWhenDueignore the wait fails 1;Also checked:
tsc --noEmitfor core,oxfmtandoxlintare clean.@hyperframes/corestays inside its size budget without raising it: the hold code ships only inside the minified runtime.Manual, in an app that embeds the Studio preview, running this runtime against today's. The project was generated: 1080x1920, six 3840x2160 h264 takes cut into 65 clips. I sampled the app's renderer memory every 2 s for 60 s after opening, on a Linux box with software rendering, one run each.
Picture at full quality, the same paused frame, today against this change, the preview cropped from the app window:
At 1/2 (the level the app picks with no GPU), the main renderer peak is 1,812 MB with this change.
What I did not exercise:
With software rendering the copies took about 50 s to land at full quality. Until then those clips showed the still.