Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smelter-loop

Reproduction for an audio bug in smelter: looping an MP4 whose duration is <= 2 seconds drops the audio in irregular gaps for the first few loops, then recovers. Video keeps playing throughout.

Run

The input file is a required argument. The app records 15s of the looped input to recording.mp4. Both clips carry a continuous 440Hz tone, so any gap is audible/visible as silence.

# Triggers the bug - 2s clip: audio is silent in irregular gaps over the
# first ~10s, then continuous:
cargo run --release -- assets/av_2s.mp4

# Works - 5s clip: audio loops cleanly:
cargo run --release -- assets/av_5s.mp4

Inspect the audio of recording.mp4 (e.g. a waveform, or silencedetect): with av_2s.mp4 it is silent in irregular gaps across roughly the first 10s while the video keeps playing; after that it is continuous.

Why this happens

Follow-up to the short-mp4 loop fix (#2123). A looped MP4 shorter than the 2s reader buffer (CHUNK_BUFFER_DURATION) never backpressures the reader, so on start it instantly pre-fills all MAX_PENDING_TRACKS (5) queued tracks in a burst, far ahead of real time.

As the queue then consumes that burst at real time, the audio of the pre-filled tracks is dropped as stale (pop_before_pts), while video holds and re-shows its last frame instead of dropping. So audio cuts out for about MAX_PENDING_TRACKS x clip_period (5 loops) until the backlog drains, then plays cleanly. The gap window scales with the clip length: ~10s for a 2s clip, ~5s for a 1s clip; clips longer than 2s never pre-fill and are unaffected.

About

Reproduction for a smelter audio bug: looping an MP4 <=2s drops audio in irregular gaps for the first few loops

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages