Skip to content

Capture: stop native call capture before a stem outgrows its WAV header - #1225

Merged
silverstein merged 1 commit into
mainfrom
fix/native-stem-cap
Oct 25, 2026
Merged

silverstein merged 1 commit into
mainfrom
fix/native-stem-cap

Conversation

@silverstein

Copy link
Copy Markdown
Owner

Summary

Fixes #1219 (from #1114). Native call-capture stems are mono f32 at the device sample rate, so the 8 h default max_duration_secs can't stand in for a size cap: the 4 GB RIFF limit arrives after ~6.2 h at 48 kHz (the rate both reporters measured, ~192 KB/s) and ~3.1 h at 96 kHz. Past it, the capture needs a manual minutes recover-stem.

  • New StemSizeGuard in minutes_core::capture: warns at 90%, then stops 64 MiB under u32::MAX (about 2.9 minutes of 96 kHz audio, far more than the 5 s check interval plus stop latency).
  • The native capture loop checks the larger stem every 5 s via the existing session.stem_paths() and routes warnings/stops through the same notices and normal finalization as the time and disk guards, so the capture is still processed.
  • Size-based, so it holds at any sample rate. No change to call_capture.rs or the Swift helper (open PR Recover microphone capture after an input disconnect #1210 is editing both).

Test plan

  • cargo fmt --all -- --check, cargo clippy --all --no-default-features -- -D warnings
  • cargo test -p minutes-core --no-default-features --lib capture:: (81 passed) including a new guard test (warn once, stop below the limit with headroom)
  • cargo test -p minutes-app --no-default-features
  • Full multi-hour native capture not exercised (the guard logic is unit-tested; the loop wiring mirrors the existing safety guard)

🤖 Generated with Claude Code

… header

Native stems are mono f32 at the device rate, so the 8 h default
max_duration_secs cannot stand in for a size cap: the 4 GB RIFF limit
arrives after ~6.2 h at 48 kHz and ~3.1 h at 96 kHz, after which the
capture needs a manual `minutes recover-stem` (#1219, from #1114).

StemSizeGuard checks the larger stem every 5 s in the native capture loop:
a warning at 90%, then a normal stop 64 MiB under the limit (about 2.9 min
of 96 kHz audio, far more than the check interval plus stop latency), so
the usual finalization and processing run. Size, not time, so it holds at
any sample rate.

Fixes #1219.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@silverstein
silverstein merged commit fc623c7 into main Oct 25, 2026
33 checks passed
@silverstein
silverstein deleted the fix/native-stem-cap branch October 25, 2026 16:34
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.

Native call capture: the 8h default cap outlasts the ~6.2h 4 GB stem limit

1 participant