Skip to content

Synchronize video preview to the audio playback clock - #783

Open
rcombs wants to merge 3 commits into
TypesettingTools:masterfrom
rcombs:codex/playback-clock
Open

rcombs wants to merge 3 commits into
TypesettingTools:masterfrom
rcombs:codex/playback-clock

Conversation

@rcombs

@rcombs rcombs commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Video preview advanced on its own wall clock. When audio took longer to start or stalled, the picture and subtitles could get ahead of the sound.

Use the audio player's reported position to schedule video frames. When audio is unavailable or ends before the picture, continue on elapsed time from the last position. Full playback now also displays the final frame.

Tested with a macOS build and the Meson test suite, including regression coverage for delayed audio startup, stalls, and the transition to silent playback.

🤖 Codex

An independent video clock advances while audio fills its output
pipeline or stalls. Use the reported audio position when available
and keep it monotonic. If audio ends, resume from the last observed
position so the picture does not jump ahead or stall.
Video used elapsed wall time to choose frames, so a large audio
output delay could put the picture and subtitles ahead of the sound.
Use the audio playback position when available and continue on
elapsed time when video plays without audio or outlasts it.

Use the frame count as the exclusive end for full playback so the
last frame can be displayed before playback stops.

This branch has not been deployed

No deployments
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