media-playback: should_read queues all video when the audio track ends first #469

Open
opened 2026-11-13 14:54:52 +00:00 by charles · 0 comments
Owner

Deferred from the review of PR #460 (Task 64, #404), round 2.

Demux::should_read (crates/fluxer-media-playback/src/player.rs) keeps reading past MAX_QUEUED_PACKETS (32) video packets while less than MIN_AUDIO_MARGIN (200 ms) of audio is buffered. If the audio track ends well before the video track (a file whose audio stream is shorter), no audio arrives any more, so:

  • the demuxer queues the rest of the file's video packets in memory, unbounded;
  • the video freezes on the stalled audio clock until the demuxer reaches EOF and check_end switches the clock to wall time.

Possible fix: a hard cap on queued video packets regardless of the audio margin, plus switching the clock to wall time when the audio output is drained while that cap holds (and back to the audio clock when audio packets arrive again). Needs a generated test clip whose audio stream is shorter than the video.

Deferred from the review of PR #460 (Task 64, #404), round 2. `Demux::should_read` (crates/fluxer-media-playback/src/player.rs) keeps reading past `MAX_QUEUED_PACKETS` (32) video packets while less than `MIN_AUDIO_MARGIN` (200 ms) of audio is buffered. If the audio track ends well before the video track (a file whose audio stream is shorter), no audio arrives any more, so: - the demuxer queues the rest of the file's video packets in memory, unbounded; - the video freezes on the stalled audio clock until the demuxer reaches EOF and `check_end` switches the clock to wall time. Possible fix: a hard cap on queued video packets regardless of the audio margin, plus switching the clock to wall time when the audio output is drained while that cap holds (and back to the audio clock when audio packets arrive again). Needs a generated test clip whose audio stream is shorter than the video.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#469
No description provided.