Repository navigation
Conversation
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
Contributor
|
AV-sync stats summary: view in run #39637731391 |
input-selector forwards the active pad's EOS. When a selected track ends
on its own while the egress runs (its appsrc stops on a negotiation
error, or its writer finishes before the track is removed), that EOS can
reach video_encoder_queue before the track's removal switches to the
filler. The filler then renegotiates behind the EOS, and its ALLOCATION
query can be left in the queue after its sender frees it, which the queue
later dequeues ("refcounting problem?").
Each track's selector pad now has an event probe. On EOS while the
pipeline is running, it switches to the filler first, so the selector
holds the EOS as it does for any inactive input. A shutdown EOS passes
unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pksgit
force-pushed
the
pradeepsharma/cs-2150-track-eos-filler-switch
branch
from
October 21, 2026 16:46
14fc35d to
c182370
Compare
This branch has not been deployed
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.
Follow-up to #1465, which listed this path under Follow-ups: a selected track's own EOS reaching the selector while the egress is running.
input-selectorforwards the active pad's EOS downstream. When a selected track ends on its own while the egress is still running, its EOS goes through the selector intovideo_encoder_queue. The track's removal then switches the selector to the filler behind that EOS. Two ways a track can end like this:not-negotiated:basesrcpushes EOS right after posting the error, and removal follows from the bus message;The EOS travels through the track's
video_input_queueon its own thread, so whether it reaches the selector before the removal's switch is a race. When it wins:video_encoder_queuewhile that EOS is still draining,gst_queuekeeps the query after its sender gives up and frees it, and the filler's STREAM_START later restarts the queue onto the freed pointer:Unexpected item ... dequeued from queue video_encoder_queue (refcounting problem?), followed by a stream error. This queue behaviour is the same in GStreamer 1.24 and 1.28.Change
Each track's selector pad gets an event probe that calls
onTrackEOS. When an EOS arrives while the pipeline is still running and the track is selected, the probe switches the selector to the filler before the EOS reaches the selector, and clears a pending handover to that track. The selector then holds the EOS as it does for any inactive input, until the track's removal releases the pad. This is the switch the track's removal already makes, moved ahead of the EOS.A track's EOS at shutdown passes unchanged. Shutdown EOS can reach the selector before the video bin's EOS function runs, but always after the pipeline has left the running state, so the probe checks the pipeline state.
Testing
TestSelectorHandover_SelectedTrackEOSWhileRunningruns the sequence against the production gates, a realinput-selectorand the productionvideo_encoder_queue: the filler is on screen, a track takes the selector, the track's EOS arrives (if forwarded, it is held past the encoder queue by a probe, standing in for the encoder draining it), the track's removal switches to the filler, the filler's ALLOCATION query is sent and freed once answered, then later filler frames arrive. It checks that the track's EOS never reaches the encoder queue, that no query is queued behind it, that pushes keep succeeding and that the filler's frames leave the selector. Without the probe it fails every run on both 1.24 and 1.28 core elements, and some runs logUnexpected item ... dequeued from queue video_encoder_queue (refcounting problem?), after which every push fails. With it, it passes.TestSelectorHandover_SelectedTrackEOSAtShutdownchecks that once the pipeline is ending, a selected track's EOS leaves the selector and the track stays selected. It fails if the probe ignores the pipeline state.go test ./pkg/...with thedeadlocktag and golangci-lint, as run bybuild/test/Dockerfile, pass.file-media,stream,segmentsandedgepass. Inmulti, theWebandParticipantCompositesubtests fail in this local setup because the test can't find their manifest files; both egresses complete, and the same two subtests fail the same way without this change. CI builds amd64.🤖 Generated with Claude Code