Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(webv2): widen the fps hang guard to 1e6 -- 1000 regressed real high-rate clips
Lincoln Stein42cf748a9efb
diff --git a/invokeai/frontend/webv2/src/features/video/core/settings.test.ts b/invokeai/frontend/webv2/src/features/video/core/settings.test.tsindex c78b0de5f5..19f0ac5771 100644--- a/invokeai/frontend/webv2/src/features/video/core/settings.test.ts+++ b/invokeai/frontend/webv2/src/features/video/core/settings.test.ts@@ -697,9 +697,15 @@ describe('reference-extend linkage', () => {endFrame: 400,startFrame: 260,});- expect(deriveReferenceExtendClip({ ...source24, fps: 1001 }, 141)).toMatchObject({ startFrame: 260 });- // The boundary itself is still a real rate.- expect(deriveReferenceExtendClip({ ...source24, fps: 1000 }, 141)).not.toMatchObject({ startFrame: 260 });+ // Below the bound, a genuinely high-rate clip still gets its REAL window:+ // 1200 fps needs 7025 source frames for 141 resampled ones. A 1000-fps+ // bound sent this through the 24 fallback, and the backend -- which+ // resamples at the rate it probes itself -- collapsed the 141-source-frame+ // window to 3 frames and raised under text conditioning's 13-frame floor.+ const highRate = { ...source24, endFrame: 50000, fps: 1200, numFrames: 50001 };++ expect(deriveReferenceExtendClip(highRate, 141)).toMatchObject({ endFrame: 50000, startFrame: 42976 });+ expect(deriveReferenceExtendClip({ ...highRate, fps: 1e17 }, 141)).toMatchObject({ startFrame: 49860 });});it('adopts an unflagged reference for the same clip instead of duplicating it (recall shape)', () => {diff --git a/invokeai/frontend/webv2/src/features/video/core/settings.ts b/invokeai/frontend/webv2/src/features/video/core/settings.tsindex 35fee0cb39..4cbc9cd855 100644--- a/invokeai/frontend/webv2/src/features/video/core/settings.ts+++ b/invokeai/frontend/webv2/src/features/video/core/settings.ts@@ -515,8 +515,16 @@ export const deriveReferenceExtendClip = (sourceVideo: VideoSourceClip, numFramestartFrame: referenceExtendStartFrame(sourceVideo, numFrames),});-/** The highest source frame rate the tail-window math accepts as real; see the fps guard below. */-const MAX_REFERENCE_SOURCE_FPS = 1000;+/**+ * The highest source frame rate the tail-window math accepts as real; see the+ * fps guard below. The float plateau it guards (`tail + 1 === tail`) starts+ * around fps 1.5e15, so 1e6 keeps nine orders of margin — a tighter bound of+ * 1000 turned real high-rate containers (probe-reported 1200 fps decoded fine+ * before) into backend hard failures: the 24 fps fallback sized a 141-SOURCE-+ * frame window that the backend, resampling at the rate it probes itself,+ * collapsed to 3 frames, under text conditioning's 13-frame minimum.+ */+const MAX_REFERENCE_SOURCE_FPS = 1e6;/** `snap_reference_num_frames`: down to the `17n + 5` grid the video VAE encodes whole. */const snapReferenceFrames = (frames: number): number => Math.max(1, Math.floor((frames - 5) / 17)) * 17 + 5;@@ -534,7 +542,7 @@ const referenceExtendStartFrame = (clip: VideoSourceClip, numFrames: number): nu// bound is a hang guard: past ~2^53 source frames, `tailSourceFrames`'// adjustment loops cannot even step (`tail + 1 === tail` in floats) and spin// forever on the main thread — a hand-edited record with fps 1e17 froze the- // tab on the first Frames keystroke. No real container exceeds 1000 fps.+ // tab on the first Frames keystroke.const fps =Number.isFinite(clip.fps) && clip.fps > 0 && clip.fps <= MAX_REFERENCE_SOURCE_FPS ? clip.fps : MINIMAX_H3_FPS;const requested = Number.isFinite(numFrames)