mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 06:19:21 +00:00
Opening a project kicked off a background transcode for every asset whose codec some browser might not decode. VP9 is on that list for Safari's sake, so a Chrome user opening a project with a VP9 avatar paid a ~10s, ~60 CPU-second re-encode across six cores on every open, concurrently with the browser's first layout, for an output nothing ever requested: across four recorded sessions the browser asked for the proxy zero times. One predicate was doing two jobs. "Could some browser fail on this" is a property of the asset and decides what gets injected into the page; "will this client request the substitute" decides whether to spend CPU before being asked. The codec table now carries an explicit prewarm flag: HEVC and ProRes (no browser decodes them) still warm; VP9 and AV1 are injected but transcoded lazily by the existing ?hf-proxy= request, which already reports failure as a 502. Pre-warms requested and proxies served are now counted on the existing structured-stderr telemetry channel, because a speculative job with a 0% hit rate emits no error and had been invisible. A single lookup helper also closes a prototype-key gap where one path used Object.hasOwn and the other a bare index. Regression test: a VP9 and an HEVC asset in one composition yield exactly one pre-warm, for the HEVC. Fails on the previous gate.