Hi all,
I’m relatively new to GStreamer and still have a limited understanding of it. I’m trying to build an application that receives H264 RTP streams over UDP and displays them using a hardware-accelerated decoder (v4l2h264dec). However, I’m facing instability and crashes when switching between two streams.
Setup
I have two independent RTP H264 streams:
Stream 1:
gst-launch-1.0 \
udpsrc port=8081 \
caps="application/x-rtp,media=video,encoding-name=H264,clock-rate=90000,payload=96" \
! rtph264depay \
! h264parse \
! v4l2h264dec \
! kmssink sync=false force-modesetting=true
Stream 2:
gst-launch-1.0 \
udpsrc port=8082 \
caps="application/x-rtp,media=video,encoding-name=H264,clock-rate=90000,payload=96" \
! rtph264depay \
! h264parse \
! v4l2h264dec \
! kmssink sync=false force-modesetting=true
Each pipeline works correctly when run independently.
Requirement
I need to dynamically switch between these two streams (e.g., based on user interaction or events).
What I Tried
1. Pipeline restart approach
- Stop pipeline (stream on port 8081)
- Start pipeline (stream on port 8082)
This works initially but leads to random crashes after multiple switches.
2. input-selector approach
- Single pipeline with two inputs
- Switch active pad dynamically
This improves behavior but still results in instability after some time.
Observed Errors
Kernel / driver logs:
vdec 30210000.video-codec: wave5_vpu_enc_finish_encode: encoded buffer (1) was not in ready queue 0.
vdec 30210000.video-codec: wave5_vpu_enc_finish_encode: no source buffer with index: 1 found
vdec 30210000.video-codec: wave5_vpu_firmware_command_queue_error_check: result not ready: 0x800
vdec 30210000.video-codec: wave5_vpu_dec_finish_decode: could not get output info.
GStreamer warning:
v4l2h264dec0: Too old frames, bug in decoder -- please file a bug
Questions
-
Is repeatedly stopping/starting pipelines with
v4l2h264decexpected to cause instability? -
Is
input-selectorthe recommended way to switch between RTP streams with hardware decoding? -
What does the
"Too old frames"warning indicate in this context?
Goal
A stable solution to:
- Keep both RTP streams active
- Switch between them dynamically
- Avoid decoder crashes or desynchronization
Any suggestions or pointers would be greatly appreciated.
Thanks!