I’m using Gstreamer in order to receive live RTSP stream, and decode it using nvv4l2decoder.
The pipeline is the following:
rtspsrc location=%s name=rtsp timeout=100000 tcp-timeout=100000 ! rtph264depay name=depay ! h264parse ! nvv4l2decoder disable-dpb=true ! nvvidconv ! video/x-raw,format=RGBA,width=%d,height=%d ! appsink name=app_sink sync=false
Since the source is not stable, it may disconnect from time to time, or may not connect in the first attemp.
To handle this, whenever I receive an error in the bus, I’m waiting 1 second, and then just throw away the entire pipeline, and construct it again (by setting state to NULL and unrefing the pipeline).
Everything works fine 99% of the time. However, in some cases, when I try to throw away the pipeline,
gst_element_set_state(pipeline, GST_STATE_NULL) just deadlocks. Also, I’m not calling this function from any streaming threads but rather the application thread.
I haven’t noticed that behaviour when I’m using
avdec_h264, so I’m assuming it’s related to the nvv4l2 decoder.
Also, it always occurs when the decoder moves to
PLAYING state but no data has flown into it yet (from what I’ve seen at least). I know this because the decoder prints some messages:
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
Whenever I see this, and I don’t get any video on my appsink - I know I’m in for a treat.
As I said, the RTSP source is not stable and many times a connection is made, but no data is flowing from it. Maybe during this time I’m not allowed to change the deocder state to NULL?
I’d appreciate any help with this issue.
Thank you very much.