fix: resolve passthrough audio not flowing in media player bridge#486
Merged
fix: resolve passthrough audio not flowing in media player bridge#486
Conversation
Three issues prevented audio from reaching downstream blocks (e.g. mpegtssrt) in passthrough mode: 1. clocksync in PAUSED state silently drops buffers — its internal flushing flag is only cleared during PAUSED→PLAYING transition. When pad-added fires during pipeline preroll, sync_state_with_parent leaves clocksync in PAUSED because the pipeline hasn't reached PLAYING yet. Fix: set clocksync to PLAYING explicitly. 2. Upstream pad linked before elements are started — urisourcebin's internal multiqueue pushes buffered data the instant a pad is linked. If clocksync is still in NULL/READY state, the push returns FLUSHING and the multiqueue permanently kills that stream's thread. Fix: link downstream first, start elements, then link upstream last. 3. push_sample error kills appsink permanently — the main pipeline's appsrc may not be ready when the first samples arrive (internal pipeline starts before main pipeline). The ? operator on push_sample returns FlowError::Error which GStreamer treats as a permanent failure. Fix: return Ok on transient errors to keep the bridge alive. Video worked by luck: it prerolled first (before adding a sink dropped the pipeline to PAUSED) so its clocksync got PLAYING state, and its multiqueue thread hadn't started pushing when the link was made. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
sync_state_with_parent()which leaves it in PAUSED during prerollWhy video worked but audio didn't
Video prerolled first (before adding a sink dropped the internal pipeline's aggregate state to PAUSED), so its clocksync got PLAYING state. Audio pad-added fired second, by which time the pipeline was in PAUSED, leaving audio clocksync stuck.
Test plan
identity -> aacparse (AAC) -> mpegtsmux🤖 Generated with Claude Code