Skip to content

fix(rendering): open recordings with an unreadable mic track - #2075

Open
richiemcilroy wants to merge 2 commits into
mainfrom
fix/unreadable-mic-track-open
Open

fix(rendering): open recordings with an unreadable mic track#2075
richiemcilroy wants to merge 2 commits into
mainfrom
fix/unreadable-mic-track-open

Conversation

@richiemcilroy

@richiemcilroy richiemcilroy commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

Investigating #2069 (claimed 0-byte audio-input.ogg files in studio mode) showed the reported mechanism cannot occur, but it surfaced a real robustness gap: the editor refused to open an entire recording when the mic track is unreadable, even though the display and camera tracks decode fine. The single-segment path even panicked.

Changes

  • crates/rendering/src/project_recordings.rs: an unreadable mic file now degrades to "no mic audio" with a warning instead of failing (or panicking on) the recording open. This mirrors the existing system-audio handling from fbc8755 and matches playback, which already degrades a broken mic track in loaded_track. Export is untouched and keeps failing loudly rather than silently dropping a track.
  • crates/enc-ffmpeg/src/mux/ogg.rs: regression tests pinning the OggFile/OpusEncoder path the issue claimed was broken: 5s of 96kHz mono input produces a playable file of the right duration, sub-frame input is flushed at finish rather than dropped, and a zero-frame track still writes container header pages instead of a 0-byte file.

Verification

  • cargo test -p cap-enc-ffmpeg: all 49 tests pass, including the 3 new ones.
  • cargo check -p cap-rendering -p cap-editor -p cap-export clean; clippy clean for the touched code.
  • End-to-end: cloned a real studio + camera bundle and truncated segment-0/audio-input.ogg to 0 bytes. Before this change the open fails with "segment 0 / mic / Failed to open audio: End of file"; after it, the recording opens and renders frame 0, with a warning logged.

Greptile Summary

This PR makes editor rendering tolerate unreadable microphone tracks while preserving strict audio validation during export.

  • Converts failed microphone metadata loads into an absent optional track with a warning in both single- and multi-segment recordings.
  • Adds Ogg/Opus regression coverage for sustained 96 kHz input, sub-frame flushing, and empty-track container headers.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified.

The editor now degrades only the optional microphone metadata track when loading fails, while required display media and export-time audio validation retain their existing failure behavior; the added encoder tests align with the current Ogg and Opus lifecycle.

Important Files Changed

Filename Overview
crates/rendering/src/project_recordings.rs The mic fallback is consistent across recording formats, retains required display-based timing, and does not weaken export’s separate strict audio validation.
crates/enc-ffmpeg/src/mux/ogg.rs The new tests exercise sustained resampling, short-input flushing, and zero-frame Ogg initialization using the existing encoder and muxer contracts.

Reviews (1): Last reviewed commit: "fix(rendering): open recordings with an ..." | Re-trigger Greptile

Context used:

…ty input

Regression tests for the studio mic path (OpusEncoder into OggFile):
5s of 96kHz mono input must land on disk with the right duration,
input shorter than one opus frame must be flushed at finish rather
than dropped, and a track that never received a frame must still
write container header pages instead of a 0-byte file.
An unreadable or empty mic file failed the entire recording open with
"segment N / mic / Failed to open audio" even when display and camera
decode fine, and the single-segment path panicked outright. Degrade the
mic to no-audio with a warning instead, matching the system-audio
handling from fbc8755 and playback's existing loaded_track behavior.
Export still validates audio strictly so a track is never silently
dropped from a deliverable.
@cursor

cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

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