Hi, I have an application that uses nvdec for accelerated H.264 decoding on the Xavier NX. I have a custom build of ffmpeg 4.3 with this h264_nvv4l2dec patch. This works great from the commandline, eg. “$ ffmpeg -c:v h264_nvv4l2dec …”, however when selecting the accelerated decoder from the C++ API I get the following segmentation fault:
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
AddressSanitizer:DEADLYSIGNAL
==141472==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000018 (pc 0xffffb14c5438 bp 0xffff8e4de930 sp 0xffff8e4ddcd0 T5)
==141472==The signal is caused by a READ memory access.
==141472==Hint: address points to the zero page.
#0 0xffffb14c5434 (/usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so+0x8434)
#1 0xffffb14bfdcc in TegraV4L2_Ioctl (/usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so+0x2dcc)
#2 0xffffb25a70a4 in plugin_ioctl (/usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/libv4l2_nvvideocodec.so+0x10a4)
#3 0xffffb598a38c in v4l2_ioctl (/lib/aarch64-linux-gnu/libv4l2.so.0+0x438c)
#4 0xffffb68ccf40 (/home/andrewdepke/client/CloudRenderVR/extern/ffmpegHwJetson/build/lib/libavcodec.so.58+0x52df40)
#5 0xffffb68cd9b8 (/home/andrewdepke/client/CloudRenderVR/extern/ffmpegHwJetson/build/lib/libavcodec.so.58+0x52e9b8)
#6 0xffffb68cddec (/home/andrewdepke/client/CloudRenderVR/extern/ffmpegHwJetson/build/lib/libavcodec.so.58+0x52edec)
#7 0xffffb7694620 in start_thread /build/glibc-RIFKjK/glibc-2.31/nptl/pthread_create.c:477
#8 0xffffb58e4498 (/lib/aarch64-linux-gnu/libc.so.6+0xd1498)
The decoding setup works fine with the standard system decoder, and I have tried testing in my own application as well as only making trivial modifications to the official decode_video.c example from FFmpeg. (Modifications include changing the codec to be h264_nvv4l2dec, and setting the pix_fmt as well as width and height before opening the codec).
Here is the modified sample: Hastebin