Nvv4l2decoder deadlock issue ( L4T32.6.1 )

Hi,

I met a deadlock issue with nvv4l2decoder.
I can stably reproduce it with following pipeline:

gst-launch-1.0 rtspsrc location=“rtsp://10.65.107.99/ch1” ! rtph264depay ! h264parse ! nvv4l2decoder ! ‘video/x-raw(memory:NVMM)’ ! tee name=tee tee.src_0 ! queue ! videorate max-rate=20 ! identity silent=false ! fakesink tee.src_1 ! queue ! videorate max-rate=10 ! identity silent=false ! fakesink -v

Using filesrc instead of rtspsrc could see similar issue as well.

But if I change nvv4l2decoder to omxh264dec, no deadlock issue seen.
Could you please help solve this issue ASAP?
Thanks.

Hi,
Does it work by setting videorate to have identical max-rate? Or without videorate? It may be an issue to read same source in different rates.

And could you add prints in the source and check where it locks? The code of gst-v4l2 is open source and can be built manually.

Hi DaneLLL,

We didn’t see deadlock issue if we set both videorate to have identical max-rate.
But our product must support different framerate conversion case.

By using gdb --pid, I can see two threads stuck at libtegrav4l2.so
Details as follow:
(gdb) i threads
Id Target Id Frame

  • 1 Thread 0x7f8708e420 (LWP 27988) “gst-launch-1.0” 0x0000007f86ce2e28 in __GI___poll (fds=0x5580477030, nfds=547723608968, timeout=)
    at …/sysdeps/unix/sysv/linux/poll.c:41
    2 Thread 0x7f7cf441f0 (LWP 27989) “queue1:src” syscall () at …/sysdeps/unix/sysv/linux/aarch64/syscall.S:38
    3 Thread 0x7f77fff1f0 (LWP 27990) “queue0:src” syscall () at …/sysdeps/unix/sysv/linux/aarch64/syscall.S:38
    4 Thread 0x7f777fe1f0 (LWP 27991) “task0” 0x0000007f86ce2e28 in __GI___poll (fds=0x7f777fc478, nfds=547713177844, timeout=)
    at …/sysdeps/unix/sysv/linux/poll.c:41
    5 Thread 0x7f76ffd1f0 (LWP 27992) “gmain” 0x0000007f86ce2e28 in __GI___poll (fds=0x55804758a0, nfds=547723608188, timeout=)
    at …/sysdeps/unix/sysv/linux/poll.c:41
    6 Thread 0x7f767fc1f0 (LWP 27993) “gdbus” 0x0000007f86ce2e28 in __GI___poll (fds=0x7f5c025fe0, nfds=547723608968, timeout=)
    at …/sysdeps/unix/sysv/linux/poll.c:41
    7 Thread 0x7f75ffb1f0 (LWP 27994) “dconf worker” 0x0000007f86ce2e28 in __GI___poll (fds=0x7f5c031b00, nfds=547723608188, timeout=)
    at …/sysdeps/unix/sysv/linux/poll.c:41
    8 Thread 0x7f757fa1f0 (LWP 27995) “nvv4l2decoder0:” 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0,
    futex_word=0x7f20182e2c) at …/sysdeps/unix/sysv/linux/futex-internal.h:88
    9 Thread 0x7f74ff91f0 (LWP 27996) “fakesrc0:src” syscall () at …/sysdeps/unix/sysv/linux/aarch64/syscall.S:38
    10 Thread 0x7f747f81f0 (LWP 27997) “fakesrc1:src” syscall () at …/sysdeps/unix/sysv/linux/aarch64/syscall.S:38
    11 Thread 0x7f73ff71f0 (LWP 27998) “task0” 0x0000007f86ce2f34 in __GI_ppoll (fds=0x7f5c070d70, nfds=546266532800, timeout=,
    sigmask=0xfffffffb) at …/sysdeps/unix/sysv/linux/ppoll.c:39
    12 Thread 0x7f737f61f0 (LWP 27999) “task0” 0x0000007f86ce2f34 in __GI_ppoll (fds=0x7f5c070d70, nfds=546266956704, timeout=, sigmask=0x0)
    at …/sysdeps/unix/sysv/linux/ppoll.c:39
    13 Thread 0x7f72ff51f0 (LWP 28000) “udpsrc1:src” 0x0000007f86ce2e28 in __GI___poll (fds=0x7f72ff4538, nfds=547546972732, timeout=)
    at …/sysdeps/unix/sysv/linux/poll.c:41
    14 Thread 0x7f727f41f0 (LWP 28001) “udpsrc5:src” syscall () at …/sysdeps/unix/sysv/linux/aarch64/syscall.S:38
    15 Thread 0x7f71ff31f0 (LWP 28002) “udpsrc4:src” syscall () at …/sysdeps/unix/sysv/linux/aarch64/syscall.S:38
    16 Thread 0x7f717f21f0 (LWP 28003) “udpsrc2:src” 0x0000007f86ce2e28 in __GI___poll (fds=0x7f717f1538, nfds=547546972732, timeout=)
    at …/sysdeps/unix/sysv/linux/poll.c:41
    17 Thread 0x7f70ff11f0 (LWP 28004) “timer” syscall () at …/sysdeps/unix/sysv/linux/aarch64/syscall.S:38
    18 Thread 0x7f27fff1f0 (LWP 28005) “rtpjitterbuffer” 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0,
    futex_word=0x7f20182dbc) at …/sysdeps/unix/sysv/linux/futex-internal.h:88
    19 Thread 0x7f277fe1f0 (LWP 28006) “timer” syscall () at …/sysdeps/unix/sysv/linux/aarch64/syscall.S:38
    20 Thread 0x7f26ffd1f0 (LWP 28007) “rtpjitterbuffer” syscall () at …/sysdeps/unix/sysv/linux/aarch64/syscall.S:38
    21 Thread 0x7f267fc1f0 (LWP 28030) “NVMDecBufProcT” 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0,
    futex_word=0x7f2000edb8) at …/sysdeps/unix/sysv/linux/futex-internal.h:88
    22 Thread 0x7f25ffb1f0 (LWP 28031) “NVMDecDisplayT” 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0,
    futex_word=0x7f20012758) at …/sysdeps/unix/sysv/linux/futex-internal.h:88
    23 Thread 0x7f257fa1f0 (LWP 28032) “NVMDecFrmStatsT” 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0,
    futex_word=0x7f20011078) at …/sysdeps/unix/sysv/linux/futex-internal.h:88
    24 Thread 0x7f249f01f0 (LWP 28033) “NVMDecBufProcT” 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0,
    futex_word=0x7f20006aac) at …/sysdeps/unix/sysv/linux/futex-internal.h:88
    25 Thread 0x7f17fff1f0 (LWP 28034) “NVMDecDisplayT” 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0,
    futex_word=0x7f200b6d7c) at …/sysdeps/unix/sysv/linux/futex-internal.h:88
    26 Thread 0x7f177fe1f0 (LWP 28035) “NVMDecFrmStatsT” 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0,
    futex_word=0x7f2009039c) at …/sysdeps/unix/sysv/linux/futex-internal.h:88
    27 Thread 0x7f16ffd1f0 (LWP 28036) “V4L2_DecThread” 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0,
    futex_word=0x7f20182e9c) at …/sysdeps/unix/sysv/linux/futex-internal.h:88

(gdb) t 8
[Switching to thread 8 (Thread 0x7f757fa1f0 (LWP 27995))]
#0 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0, futex_word=0x7f20182e2c)
at …/sysdeps/unix/sysv/linux/futex-internal.h:88
88 …/sysdeps/unix/sysv/linux/futex-internal.h: 没有那个文件或目录.
(gdb) bt
#0 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0, futex_word=0x7f20182e2c)
at …/sysdeps/unix/sysv/linux/futex-internal.h:88
#1 0x0000007f86d822a4 in __pthread_cond_wait_common (abstime=0x0, mutex=0x7f20182dd0, cond=0x7f20182e00) at pthread_cond_wait.c:502
#2 0x0000007f86d822a4 in __pthread_cond_wait (cond=0x7f20182e00, mutex=0x7f20182dd0) at pthread_cond_wait.c:655
#3 0x0000007f85b28fdc in () at /usr/lib/aarch64-linux-gnu/tegra/libnvos.so
#4 0x0000007f85175bf0 in TegraV4L2_Poll_CPlane () at /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so
#5 0x0000007f851e02e4 in plugin_ioctl () at /usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/libv4l2_nvvideocodec.so
#6 0x0000007f85bf75c0 in v4l2_ioctl () at /usr/lib/aarch64-linux-gnu/libv4l2.so.0
#7 0x0000007f85dcf6b4 in gst_v4l2_allocator_dqbuf () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/eswin/libgstnvvideo4linux2.so
#8 0x0000007f85dc9344 in gst_v4l2_buffer_pool_dqbuf () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/eswin/libgstnvvideo4linux2.so
#9 0x0000007f86f53600 in gst_buffer_pool_acquire_buffer () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#10 0x0000007f85dc414c in gst_v4l2_video_dec_loop () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/eswin/libgstnvvideo4linux2.so
#11 0x0000007f86fc5eb4 in () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#12 0x0000007f86eae000 in () at /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0

(gdb) t 18
[Switching to thread 18 (Thread 0x7f27fff1f0 (LWP 28005))]
#0 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0, futex_word=0x7f20182dbc)
at …/sysdeps/unix/sysv/linux/futex-internal.h:88
88 …/sysdeps/unix/sysv/linux/futex-internal.h: 没有那个文件或目录.
(gdb) bt
#0 0x0000007f86d822a4 in futex_wait_cancelable (private=, expected=0, futex_word=0x7f20182dbc)
at …/sysdeps/unix/sysv/linux/futex-internal.h:88
#1 0x0000007f86d822a4 in __pthread_cond_wait_common (abstime=0x0, mutex=0x7f20182d60, cond=0x7f20182d90) at pthread_cond_wait.c:502
#2 0x0000007f86d822a4 in __pthread_cond_wait (cond=0x7f20182d90, mutex=0x7f20182d60) at pthread_cond_wait.c:655
#3 0x0000007f85b28fdc in () at /usr/lib/aarch64-linux-gnu/tegra/libnvos.so
#4 0x0000007f85175a38 in TegraV4L2_Poll_OPlane () at /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so
#5 0x0000007f851e00f8 in plugin_ioctl () at /usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/libv4l2_nvvideocodec.so
#6 0x0000007f85bf75c0 in v4l2_ioctl () at /usr/lib/aarch64-linux-gnu/libv4l2.so.0
#7 0x0000007f85dcf6b4 in gst_v4l2_allocator_dqbuf () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/eswin/libgstnvvideo4linux2.so
#8 0x0000007f85dc9344 in gst_v4l2_buffer_pool_dqbuf () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/eswin/libgstnvvideo4linux2.so
#9 0x0000007f85dca5fc in gst_v4l2_buffer_pool_process () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/eswin/libgstnvvideo4linux2.so
#10 0x0000007f85dc1570 in gst_v4l2_video_dec_handle_frame () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/eswin/libgstnvvideo4linux2.so
#11 0x0000007f86127754 in () at /usr/lib/aarch64-linux-gnu/libgstvideo-1.0.so.0
#12 0x0000005580447830 in ()

Hi,
The decoder is not able to handle different rate for single source. A possible solution is to link to appsink like:

gst-launch-1.0 rtspsrc location=“rtsp://10.65.107.99/ch1” ! rtph264depay ! h264parse ! nvv4l2decoder ! ‘video/x-raw(memory:NVMM)’ ! tee name=tee tee.src_0 ! queue ! appsink tee.src_1 ! queue ! appsink -v

And add code in appsink to drop the frames to fit the frame rate.

Hi DaneLLL,

The solution you proposed seems too complicated for us.
We would rather use omxh264dec in such case.

But as omxh264dec was deprecated, could Nvidia provide a fix on this issue?
Thanks a lot.

Hi,
We will check this and see if we can support the use-case in Jetpack 5. For using Jetpack 4, please try the proposed solution.