Repository navigation
fix(nvdsdynamicsrcbin): drain decoder per file and avoid stall on switch - #132
Open
nv-support wants to merge 2 commits into
Open
nv-support wants to merge 2 commits into
nv-support wants to merge 2 commits into
Conversation
Push a still-frame event into the decoder before the custom-eos-event at the end of each file. GstVideoDecoder drains on it without going EOS, so all frames of the file are output before the end marker and the dynamic-src-bin-file-change message. The event is dropped at the bin's src pad. Drop RECONFIGURE events at the parsebin sink pad. When one reaches filesrc right after its last buffer, filesrc renegotiates and its ALLOCATION query is queued behind that buffer; the queue discards it when the demuxer returns EOS, filesrc blocks and the file never ends. Fixes #128 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: junshengy <junshengy@nvidia.com>
nv-support
force-pushed
the
fix/128-dynamicsrcbin-file-switch
branch
from
November 17, 2026 12:09
44d8dfd to
fa9d01d
Compare
nv-support
marked this pull request as ready for review
November 17, 2026 12:10
Turn the per-file EOS into a custom serialized event at the sink pad of queue_parsebin and generate the end-of-file events from it. queue_parsebin is kept for all files. With an EOS, its task pauses once it has pushed the EOS. The next file can be linked while that push is still blocked downstream (e.g. in nvinfer, which waits for its queues to empty); its stream-start clears the EOS state before the task pauses, so nothing restarts the task and every buffer of the next file gets EOS. Playback then stops with no error. Refs #128 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: junshengy <junshengy@nvidia.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.
Description
Fixes #128.
Two changes in
gstnvdsdynamicsrcbin.c:custom-eos-event.GstVideoDecoderdrains on it without going EOS, so all frames of the file come out before the end marker. The event is dropped at the bin's src pad and does not reach downstream elements.parsebinsink pad. Upstream ofparsebinis an unparsed byte stream, so there is nothing to renegotiate there.Event names, fields and bus messages are unchanged; no change is needed in Service Maker,
pyservicemakeror the sample.Reason
Frame loss. The bin replaces the per-file EOS with a
custom-eos-eventand a GAP before the decoder, so the decoder is never drained. It still holds the file's last frames when thecustom-eos-eventgoes out, and thedynamic-src-bin-file-changemessage posted from it comes before those frames.MediaExtractorcloses the chunk on that message and drops the later frames (22 to 27 of 30 frames per 1 s chunk); the last file's held frames never come out.Playback stops with no error. For each file the bin builds a new
filesrc ! queue ! parsebin. Whileparsebinlinks its internal elements and its src pad, each link sends a RECONFIGURE upstream. A 1 s file is read in about 1 ms, so one can arrive just afterfilesrcpushed its last buffer.filesrcthen renegotiates and its ALLOCATION query is queued behind that buffer; the demuxer returns EOS for the buffer, the queue discards the query, andfilesrcwaits forever (gst_queue_handle_sink_query,gstqueue.c:1119). The file never ends, so the bin never switches.Validation
deepstream:9.2-triton-multiarchcontainersources/gst-plugins/gst-nvdynamicsrcbin), plugin rebuilt withmake CUDA_VER=13.2bash ./build/build.sh --package)deepstream_dynamicsrcbin_test, 50 files, 120 runs-movflags +faststart, 120 runssample_1080p_h264.mp4sample_1080p_h265.mp4remove-source0.5 s afteradd-sourceMediaChunk(duration=0.5 s), 20 chunkspython/tests/test_media.pyKnown limitations:
Checklist
NVIDIA/DeepStream:develop.NVIDIA/DeepStream:develop.bash ./build/build.sh --packagecompleted successfully.deepstream-appon x86 or Jetson.git commit -s).CHANGELOG.mdare updated, where applicable.🤖 Generated with Claude Code