mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-14 18:01:20 +08:00
e1f63a85e1
PR #822's software-renderer guard auto-flipped `captureMode` to "screenshot" whenever `resolveBrowserGpuMode` returned "software" — but the WebGL probe classifies GitHub Actions runners (SwiftShader) as "software" too, even though `HeadlessExperimental.beginFrame` works on them. As a result the guard pessimized mainstream CI, exceeding `ffmpegStreamingTimeout` (10 min default) on the largest fixtures and producing this regression on three shards of run 25841853063: - fast → sub-composition-video (390 frames, 1080×1920, video + sub-comp) - styles-e → style-13-prod (12 MB baseline, slow tag) - styles-g → overlay-montage-prod (42.36 s duration, 1080×1920) All three failed with `Streaming encode failed: FFmpeg exited with code 255 ... received signal 15`. Wall-clock for overlay-montage-prod jumped from 9 m 13 s (main, beginframe) to 10 m 38 s (PR-822, screenshot) — just past the streaming timeout. ffmpeg was alive and consuming frames the whole time; the producer side simply couldn't sustain the rate in screenshot mode for these fixtures. Fix: gate the auto-flip behind an opt-in env var `HYPERFRAMES_FORCE_SCREENSHOT_ON_SOFTWARE_GPU`. When unset (default), the GPU probe is skipped entirely and the original (pre-PR-822) capture-mode selection runs — Linux + headless-shell → beginframe, with the existing `probeBeginFrameSupport` fallback handling actual BeginFrame unavailability at runtime. Operators on hosts where BeginFrame is technically present but stalls under shader load (the CPU-only Linux sandbox where hf#677 was reproduced) set the env var to short-circuit BeginFrame entirely. Mirrored the same gate in `frameCapture.ts`'s preMode resolution so the expensive probe Chrome is also skipped on the chromeArgs side when the guard is off. Tests: kept all eight software-renderer tests; flipped the block-scoped default to "guard ON" (set in `beforeEach`) so the pre-existing assertions exercise the guard path. Added a positive-control test that pins the new default behavior: `Linux + software + headless-shell + guard OFF → beginframe` (the regression case). — Vai