Revert "feat(producer): renderStretch to re-time short compositions across longer scenes (#2676)" (#2730)

This reverts commit e786b78b33.
This commit is contained in:
Xuanru Li
2026-07-21 19:39:03 -07:00
committed by GitHub
parent 807078c7cd
commit 69446e7726
20 changed files with 15 additions and 159 deletions
+3 -8
View File
@@ -2709,9 +2709,8 @@ export async function verifyStaticFramesSafe(
if (last && f === last.b + 1) last.b = f;
else runs.push({ a: f, b: f });
}
const renderStretch = session.options.renderStretch ?? 1;
const seekToFrame = async (frameIdx: number): Promise<void> => {
const t = quantizeTimeToFrame((frameIdx / fps) * renderStretch, fps);
const t = quantizeTimeToFrame(frameIdx / fps, fps);
await page.evaluate((tt: number) => {
const hf = (
window as unknown as {
@@ -3649,14 +3648,11 @@ async function captureDeVerificationFrames(
// their data-duration, and infinite-repeat GSAP reports a huge sentinel —
// and indices derived from it would never be drained, silently disarming
// verification for exactly the comps that need it.
// compositionDurationSeconds is already the output (drained) duration; the raw
// page fallback is intrinsic — divide it by renderStretch to match (1 = no-op).
const renderStretch = session.options.renderStretch ?? 1;
const duration =
session.options.compositionDurationSeconds ??
(await page.evaluate(
() => (window as unknown as { __hf?: { duration?: number } }).__hf?.duration ?? 0,
)) / renderStretch;
));
const totalFrames = Math.floor(duration * fps);
if (totalFrames < 10) return;
if (duration > 3600) {
@@ -3706,8 +3702,7 @@ async function captureDeVerificationFrames(
while (boundary.has(idx) && guard++ < 6) idx = Math.min(totalFrames - 1, idx + 2);
if (boundary.has(idx)) continue;
if (frames.has(idx)) continue;
// Seek truth with the same ×renderStretch mapping the real capture uses for output frame idx.
const t = quantizeTimeToFrame((idx / fps) * renderStretch, fps);
const t = quantizeTimeToFrame(idx / fps, fps);
await seekTo(t);
// Video frame injection (same hook the real capture paths run) — without
// it, <video> elements screenshot black and every video comp would
@@ -23,7 +23,6 @@ import {
type CapturePerfSummary,
type BeforeCaptureHook,
} from "./frameCapture.js";
import { outputFrameToTimelineSeconds } from "@hyperframes/core";
import { DEFAULT_CONFIG, type EngineConfig } from "../config.js";
import { assertSwiftShader } from "../utils/assertSwiftShader.js";
import { readWebGlVendorInfoFromCanvas } from "../utils/readWebGlVendorInfoFromCanvas.js";
@@ -369,10 +368,6 @@ async function captureFrameRange(
let framesCaptured = 0;
const outputOffset = task.outputFrameOffset ?? 0;
const stride = task.frameStride ?? 1;
// Per-frame seek ×renderStretch maps frames across [0, intrinsic] (1 = no-op).
const renderStretch = captureOptions.renderStretch ?? 1;
const seekTime = (i: number): number =>
outputFrameToTimelineSeconds(i, captureOptions.fps, renderStretch);
// Depth-2 pipelined drawElement produce (HF_DE_PARALLEL_STREAM spike): frame
// k's in-page worker encode overlaps frame k+stride's produce phase — the
// same shape as the sequential worker-encode loop. Only engaged when the
@@ -392,7 +387,7 @@ async function captureFrameRange(
let prev: { idx: number; encodeResult: Promise<Buffer> } | null = null;
for (let i = task.startFrame; i < task.endFrame; i += stride) {
if (signal?.aborted) throw new Error("Parallel worker cancelled");
const time = seekTime(i);
const time = (i * captureOptions.fps.den) / captureOptions.fps.num;
if (dbg && i < task.startFrame + dbgWin) {
console.log(`[par:w${task.workerId}] +${Date.now() - dbgT0}ms produce ${i} start`);
}
@@ -436,7 +431,7 @@ async function captureFrameRange(
}
for (let i = task.startFrame; i < task.endFrame; i += stride) {
if (signal?.aborted) throw new Error("Parallel worker cancelled");
const time = seekTime(i);
const time = (i * captureOptions.fps.den) / captureOptions.fps.num;
const fileFrameIdx = i - outputOffset;
if (onFrameBuffer) {