Repository navigation
feat(core): a heavy clip's lighter copy can be made ahead of time - #6982
Conversation
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 1 nit · head 31d41538
- nit: the two new helpers went in between an existing doc comment and the function it describes.
copyVariant(packages/core/src/runtime/mediaProxy.ts:506) now sits underswapToProxy's doc block, andlowerPriorityUnlessExited(packages/studio-server/src/helpers/proxyTranscoder.ts:790) sits underspawnFfmpeg's, so the IDE hover text on all four functions is wrong. Moving each helper above its doc block fixes it.
Scope
Read the full diff (9 files). The ahead-of-time URL matches what makeCopy builds for a real 1/2 step-down (same currentSrcValue, variant, scalePreviewProxyBox(shown, 0.5), light=true), so both share one cache entry. One background copy runs at a time and polling stops while the film plays; the server job keeps running because it has no signal, as the body says. The niceness is checked again for each piece and lifted by prioritize. The flag is off by default. Locally, mediaProxy.test.ts passed 72/72 and proxyTranscoder.test.ts passed 76/76. I put mediaProxy.ts, proxyWait.ts and proxyTranscoder.ts back to their main versions: "asks for the copy…", "makes one at a time" and the lowest-priority test then fail. "starts nothing while the film plays" and "waits for the clip to be on screen" are negative tests that still pass against a no-op stub. At 3da5e59a the non-required Comments ratchet failed; 31d41538 fixes it. The required checks were still running when I posted this.
— genesis-v2 (Lane B)
Edit accuracy: accurate 271 (base branch 271), smooth 111 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
31d4153 to
ae840b4
Compare
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 new · 31d41538 → ae840b4b. This head is a rebase. The PR diff against the new merge-base matches 31d41538 line for line; only the hunk offsets moved. The base changes to mediaProxy.ts (dropUnneededCopy and the wanted() guard) do not touch the new code. Locally, mediaProxy.test.ts passed 73/73 and proxyTranscoder.test.ts passed 76/76. The earlier doc-comment nit still applies.
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 new · ae840b4b → aef2a6ad. The only change moves the box choice in nextCopyAhead into copyAheadBox, and it behaves the same. When displayScale === null, every element now gets a null box, so the result is still null. isShown is still called only when the source facts exist. Locally, mediaProxy.test.ts passed 73/73.
aef2a6a to
a8a3129
Compare
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 new · aef2a6ad → a8a31295. This head is a rebase. The PR diff against the new merge-base matches aef2a6ad line for line. The 21 base files that changed include none of the files this PR touches, and none of them reference waitForServedProxy, resolveProxy, the priority header or set-copies-ahead. Locally, mediaProxy.test.ts passed 73/73 and proxyTranscoder.test.ts passed 76/76.
There was a problem hiding this comment.
Verdict: APPROVE · 0 blocker · 0 important · 0 new · a8a31295 → 9d728674. The route now passes { background: true } when the header is "0" and { priority: asked === "1" } otherwise, so non-background requests get the same options shape as before this PR, and resolveProxy reads a missing flag as false. Locally, preview.test.ts passed 145/145 and proxyTranscoder.test.ts passed 76/76. The new route test fails against the a8a31295 route.
What changes for people
Nothing yet, until a host turns this on. A host can send a new
set-copies-aheadcontrol message; while it's on, the preview makes the 1/2-size lighter copy of a heavy clip on screen before it's needed. If the clip then starves, the switch takes about a second instead of waiting for the copy to be made.isHeavyForPreviewcalls heavy at the 1/2 size, the same rule and the same cached copy as a real step down.X-HF-Proxy-Priority: 0marks them; a piece already encoding stays low, later pieces run normally. On Unix a process can't raise its own priority back.fails without the fix:
mediaProxy.test.ts, "asks for the copy the first step down would use, and leaves the video on its source", "starts nothing while the film plays", "makes one at a time", "waits for the clip to be on screen";proxyTranscoder.test.ts, "runs a background copy's encode at the lowest priority, until a viewer asks for it".What I measured
A real Mac (M-series, 24 GB) running a released desktop build with only this runtime swapped in, 60 s 4K 10-bit HEVC at 80 Mbps, network throttled to 3 MB/s, one run each.
The CPU row is at normal priority: the server in that build isn't patched, so the low priority is covered by the unit test only.
What I did NOT exercise
Size
9 files, about 190 lines, most of them tests.