Skip to content

Commit cc7622c

Browse files
authored
Merge pull request #926 from heygen-com/fix/ci-chrome-pin-and-psnr-harness
fix(ci): pin chrome-headless-shell + clamp PSNR checkpoint to a valid frame
2 parents 27efcd0 + 21e68d9 commit cc7622c

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

Dockerfile.test

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ ENV CONTAINER=true
5353
# Install chrome-headless-shell for deterministic BeginFrame rendering.
5454
# This lightweight Chrome binary supports HeadlessExperimental.beginFrame.
5555
# Install to ~/.cache/puppeteer/ where resolveHeadlessShellPath() looks.
56-
RUN npx --yes @puppeteer/browsers install chrome-headless-shell@stable \
56+
#
57+
# Pinned to a specific build (NOT @stable) so the regression-test golden
58+
# baselines in packages/producer/tests/*/output/output.mp4 stay reproducible.
59+
# Each Chrome stable bump shifts pixel output enough to fail PSNR. Bump this
60+
# version together with regenerating baselines via `docker:test:update`.
61+
RUN npx --yes @puppeteer/browsers install chrome-headless-shell@148.0.7778.167 \
5762
--path /root/.cache/puppeteer \
5863
&& find /root/.cache/puppeteer/chrome-headless-shell -name "chrome-headless-shell" -type f \
5964
&& echo "chrome-headless-shell installed"

packages/producer/src/regression-harness.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,16 +1096,19 @@ async function runTestSuite(
10961096
videoMetadata.durationSeconds,
10971097
snapshotMetadata.durationSeconds,
10981098
);
1099+
const fps = fpsToNumber(suite.meta.renderConfig.fps);
1100+
// Container duration includes audio padding past the last video frame
1101+
// (e.g. many-cuts: 5.654s container vs 5.6s of video). At i=99 the
1102+
// raw container duration maps to a frame index past nb_frames, and
1103+
// ffmpeg's PSNR filter emits no `average:` line for a non-existent
1104+
// frame. Subtract one frame interval so the last checkpoint always
1105+
// lands on a frame the video stream actually contains.
1106+
const sampleDuration = Math.max(0, videoDuration - 1 / fps);
10991107

11001108
const minPsnrForMode = resolveMinPsnrForMode(options.mode, suite.meta.minPsnr);
11011109
for (let i = 0; i < 100; i++) {
1102-
const time = (videoDuration * i) / 100;
1103-
const psnr = psnrAtCheckpoint(
1104-
renderedOutputPath,
1105-
snapshotVideoPath,
1106-
time,
1107-
fpsToNumber(suite.meta.renderConfig.fps),
1108-
);
1110+
const time = (sampleDuration * i) / 100;
1111+
const psnr = psnrAtCheckpoint(renderedOutputPath, snapshotVideoPath, time, fps);
11091112
visualCheckpoints.push({
11101113
time,
11111114
psnr,

0 commit comments

Comments
 (0)