Skip to content

Commit 73096f4

Browse files
jrusso1020claude
andauthored
fix(producer): plan screenshot capture for a supersampled distributed render (#9124)
A supersampled page is always captured in screenshot mode, but the plan recorded BeginFrame for it. Every chunk then started, found the browser in the other mode, stopped its workers and captured the chunk again. The plan now records screenshot capture when the output resolution supersamples the page, so a chunk starts in the mode it will use. Signed: Rames Jusso Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
1 parent 7cd7053 commit 73096f4

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

‎packages/producer/src/services/distributed/plan.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,31 @@ describe("plan() and page motion blur (R19)", () => {
608608
}, 60_000);
609609
});
610610

611+
describe("plan() and supersampled output", () => {
612+
it("locks screenshot capture when the output resolution supersamples the page", async () => {
613+
const html = FIXTURE_HTML.replace('data-height="240"', 'data-height="180"');
614+
expect(html).not.toBe(FIXTURE_HTML);
615+
const lockedCapture = async (name: string, outputResolution?: "landscape") => {
616+
const dir = join(runRoot, name);
617+
mkdirSync(dir, { recursive: true });
618+
writeFileSync(join(dir, "index.html"), html, "utf-8");
619+
const planDir = join(runRoot, `${name}-plan`);
620+
const config = { fps: 30, width: 320, height: 180, format: "mp4", outputResolution } as const;
621+
await plan(dir, config, planDir);
622+
const meta = JSON.parse(readFileSync(join(planDir, "meta", "encoder.json"), "utf-8"));
623+
return { captureMode: meta.captureMode, forceScreenshot: meta.forceScreenshot };
624+
};
625+
expect(await lockedCapture("supersampled", "landscape")).toEqual({
626+
captureMode: "screenshot",
627+
forceScreenshot: true,
628+
});
629+
expect(await lockedCapture("native-size")).toEqual({
630+
captureMode: "beginframe",
631+
forceScreenshot: false,
632+
});
633+
}, 60_000);
634+
});
635+
611636
describe("buildChunkSlices", () => {
612637
it("produces consecutive non-overlapping ranges covering all frames", () => {
613638
const slices = buildChunkSlices(700, 3, 240);

‎packages/producer/src/services/distributed/plan.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ async function compilePlanComposition(
13751375
// TODO: move this bump into compileStage so both call sites simplify and
13761376
// the rule lives in one place (follow-up; out of scope for #1236 fix).
13771377
let forceScreenshot = compileResult.forceScreenshot;
1378-
if (cfg.lowMemoryMode) forceScreenshot = true;
1378+
if (cfg.lowMemoryMode || deviceScaleFactor !== 1) forceScreenshot = true;
13791379
// composition.{width,height} are the authored page dimensions. The
13801380
// post-supersample output dims are `compileResult.outputWidth/outputHeight`
13811381
// — chunks render at output dims, but planHash + composition.json record

0 commit comments

Comments
 (0)