Nvv4l2h264enc segment fault on IDR if in GST_STATE_READY state


I met a segment fault issue when emitting ‘force-IDR’ signal to nvv4l2h264enc while pipeline was in GST_STATE_READY state.
But no such issue if pipeline was in null, paused or playing state.

Backtrace as follow:

Program received signal SIGSEGV, Segmentation fault.
0x0000007fb6a1ba8c in ?? () from /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so
(gdb) bt
#0 0x0000007fb6a1ba8c in () at /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so
#1 0x0000007fb6a0ce58 in () at /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so
#2 0x0000007fb6a10e60 in () at /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so
#3 0x0000007fb6a05960 in TegraV4L2_Ioctl () at /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so
#4 0x0000007fb7855ee8 in plugin_ioctl () at /usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/libv4l2_nvvideocodec.so
#5 0x0000007fb6d1a5c0 in v4l2_ioctl () at /usr/lib/aarch64-linux-gnu/libv4l2.so.0
#6 0x0000007fb6ed8854 in gst_v4l2_video_encoder_forceIDR () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/eswin/libgstnvvideo4linux2.so
#7 0x0000007fb7e2a858 in g_closure_invoke () at /usr/lib/aarch64-linux-gnu/libgobject-2.0.so.0

Although it is not valid to force IDR if pipeline is in ready state, I think nvv4l2h264enc should gracefully return error code like it does in null state.

The source code of gst-v4l2 is public so you can customize the plugin to include the state check. You can add code in gst_v4l2_video_encoder_forceIDR() to get the state. If it is in READY state, not to call in libtegrav4l2.so

But we also met another scenario that plugin just entered playing state, but similar signal11 observed if ‘force-IDR’ was generated at same time (the 1st frame was not generated yet. Video source is a live source)

It looks not good to set runtime bitrate at beginning of PLAY state. Generally we would expect the initial bitrate is accurate and run for a period. Suggest you set a more precise initial bitrate. Besides, we would suggest a-few-second interval between each bitrate change.

Hi DaneLLL,

I am confused with your reply as this issue is related to ‘force-IDR’ not bitrate. (I had another thread on framerate indeed.)
Anyway I solved my issue by checking the state of the encoding task in gst_v4l2_video_encoder_forceIDR().
We will ignore the ‘force-IDR’ request if encoding task not in started state.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.