fix(video): make one-frame scene sampling deterministic (#11344)

Merged via consolidated batch validation. Makes scene_aware Video Bridge sampling deterministic for a one-frame budget: falls back to the midpoint of the active full-video/focus window and reports policyEffective: uniform (a single scene candidate can't preserve both temporal ends). Adds opt-in real-FFmpeg fixture matrix (rapid edge cuts, one-frame budget, static/gradual scenes, sub-second clips, detector failure). Static gates green; own regression suite (videoBridgeSampler.test.ts, video-bridge-sampler-ffmpeg.test.ts) passed in the combined-batch run. Related to #9760. Thanks!
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-08-24 09:44:50 -03:00
committed by GitHub
parent c83116e634
commit 04d2a60331
5 changed files with 257 additions and 1 deletions

View File

@@ -339,6 +339,15 @@ export function calculateSamplingDecision(
}
const frameCount = uniform.length;
if (frameCount === 1) {
return {
candidateCount: candidates.length,
...(focusWindow ? { focusWindow } : {}),
policyEffective: "uniform",
policyRequested: "scene_aware",
timestamps: uniform,
};
}
const selected =
candidates.length <= frameCount
? [...candidates]