Skip to content

fix(producer): tolerate rounded frame-boundary durations#2239

Open
miguel-heygen wants to merge 1 commit into
mainfrom
fix/frame-count-decimal-duration
Open

fix(producer): tolerate rounded frame-boundary durations#2239
miguel-heygen wants to merge 1 commit into
mainfrom
fix/frame-count-decimal-duration

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

  • avoid an extra output frame when a decimal duration is a serialized approximation of an exact frame boundary
  • retain ceiling behavior for durations that genuinely extend into the next frame

Why

At 30fps, a static duration of 32.866667 represents 986 frames after six-decimal serialization. Multiplication yields 986.00001, so the producer probe stage's raw Math.ceil scheduled 987 frames and required a post-render one-frame trim.

How

Convert duration to frame count by snapping values within 0.001 frame of an integer boundary, otherwise ceiling as before. This tolerance is wider than six-decimal metadata error even at high frame rates, while remaining far below a visible frame interval.

Test plan

  • added a regression test that first failed with 987 and now returns 986 for 32.866667 at 30fps
  • added a guard test confirming 32.867 still ceilings to 987
  • bun test packages/producer/src/services/render/stages/probeStage.test.ts
  • bun run --filter @hyperframes/producer typecheck
  • bunx oxlint packages/producer/src/services/render/stages/probeStage.ts packages/producer/src/services/render/stages/probeStage.test.ts
  • pre-commit lint, format, fallow, and typecheck hooks passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant