Nvv4l2decoder stucks in gst_v4l2_video_dec_handle_frame

Hello,
We use nvv4l2decoder to decode h.265 stream on Xavier. From time to time nvv4l2decoder stucks in gst_v4l2_video_dec_handle_frame function inside cycle while(1), because each call to ioct VIDIOC_DQEVENT (gstv4l2videodec.c:1408) return -1 with errno message “Resource temporarily unavailable”. We tried to drop the frame after few unsuccessful calls to ioct VIDIOC_DQEVENT, just to avoid an endless loop, but the situation repeats on each next frame. Also we tried to recreate nvv4l2decoder object and use it insdead the previous one in this pipeline, but it also didn’t help. The only way is to recreate the whole pipeline, but it is not very acceptable for us.

Hi,
Please share the command so that we can replicate the issue. If it is specific to certain video file, please provide the file .

It’s hard to build the same pipeline as we used in the console, but here the very similar pipelines.
Publish pipeline:

gst-launch-1.0 -e v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080,format=UYVY ! queue leaky=2 max-size-bytes=0 max-size-buffers=30 ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=I420,width=1920,height=1080,framerate=30/1’ ! nvv4l2h265enc bitrate=10000000 ! h265parse ! rtph265pay config-interval=-1 ! application/x-rtp,media=video,encoding-name=H265,payload=96 ! udpsink host=127.0.0.1 port=5000 buffer-size=4194304

Receiver pipeline:

gst-launch-1.0 -v udpsrc port=5000 caps=“application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96” ! rtph265depay ! h265parse ! queue leaky=2 max-size-buffers=10 ! nvv4l2decoder ! nvvidconv ! queue leaky=2 max-size-buffers=10 ! ‘video/x-raw(memory:NVMM),width=1920,height=1080’ ! nv3dsink

Each Xavier run our application, where we always have one publish pipeline and from 0 to many receiver pipelines simultaneously. Problem with the decoder stucking reproduces even with one publish and one receiver pipeline. To reproduce this problem we usually need up to 10 times restart pipelines, but not restart the whole application.
Also I attached GStreamer logs for a good case and a bad case. nvv4l2decoder_good_case.txt (1.7 MB) nvv4l2decoder_bad_case.txt (1.2 MB)
We only added to nvv4l2decoder few log lines to understand, where it stucks, and didn’t do any other changes. So, decoder always stucks with this error:

0:02:51.661583498 13550 0x7f00003e80 DEBUG v4l2videodec gstv4l2videodec.c:1411:gst_v4l2_video_dec_handle_frame: before usleep(100*1000), Resource temporarily unavailable

Hi,
Do you observe the issue in default 4Mbps? Would like to know if the bitrate setting triggers the issue. And do you use JP4.4.1(r32.4.4)?

Hello,
We used Jetpack version: 4.4.1 - b50, R32 REVISION 4.3
We always specify the bitrate for the encoder and do not use the default one. But the issue reproduces more rarely for lesser bitrate values.

Hi,
Please set insert-sps-pps=1 to nvv4l2h265enc plugin and try again. We run the pipeline and don’t observe the issue:

$ gst-launch-1.0 -e videotestsrc is-live=1 ! video/x-raw,width=1920,height=1080,format=UYVY ! queue leaky=2 max-size-bytes=0 max-size-buffers=30 ! nvvidconv ! "video/x-raw(memory:NVMM),format=I420,width=1920,height=1080,framerate=30/1" ! nvv4l2h265enc bitrate=10000000 insert-sps-pps=1 ! h265parse ! rtph265pay config-interval=-1 ! application/x-rtp,media=video,encoding-name=H265,payload=96 ! udpsink host=127.0.0.1 port=5000 buffer-size=4194304