Using gstnv plugins with latest compiled gstreamer

I successfully compiled the latest gstreamer version 1.17.1 using gst-build repo.

What I did then:

  • copied the compiled nvidia plugins to the build folder:
    cp /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnv* /home/jetson/gst-build/build/subprojects/nvidia/gst/

  • exported this folder so the gstreamer would pick them up successfully:
    export GST_PLUGIN_PATH=/home/jetson/gst-build/build/subprojects/nvidia/gst:$GST_PLUGIN_PATH

  • I can see the plugins successfully loaded:

[gst-master] jetson@xavier:~/gst-build$ gst-inspect-1.0 |grep nv
nvarguscamerasrc:  nvarguscamerasrc: NvArgusCameraSrc
nveglstreamsrc:  nveglstreamsrc: nVidia EGL Stream
nvvideocuda:  videocuda: CUDA Post processor
nvvideosink:  nvvideosink: nVidia Video Sink
nvtee:  nvtee: NvTee
nvcompositor:  nvcompositor: NvCompositor
nvvidconv:  nvvidconv: NvVidConv Plugin
nvivafilter:  nvivafilter: NvIVAFilter Plugin
nvvideo4linux2:  nvv4l2decoder: NVIDIA v4l2 video decoder
nvvideo4linux2:  nvv4l2h264enc: V4L2 H.264 Encoder
nvvideo4linux2:  nvv4l2h265enc: V4L2 H.265 Encoder
nvvideo4linux2:  nvv4l2vp8enc: V4L2 VP8 Encoder
nvvideo4linux2:  nvv4l2vp9enc: V4L2 VP9 Encoder
nvdrmvideosink:  nvdrmvideosink: Nvidia Drm Video Sink
nvjpeg:  nvjpegenc: JPEG image encoder
nvjpeg:  nvjpegdec: JPEG image decoder
nveglglessink:  nveglglessink: EGL/GLES vout Sink
nvegltransform:  nvegltransform: NvEGLTransform
nvvideosinks:  nv3dsink: Nvidia 3D sink

but when running my pipeline I see the error described in this issue that was fixed in 1.17 version, and I can see that when not using any nvidia plugin, the error does not appear.

One maintainer of gstreamer mentioned the nvidia plugins might be linking to wrong so files, but I can’t seem to debug this on my own, can you please help or provide fresh compiled plugins for the latest gstreamer version?

More debug lines:

[gst-master] jetson@xavier:~/gst-build$ ldd /home/jetson/gst-build/build/subprojects/nvidia/gst/libgstnvarguscamerasrc.so |grep gst
	libgstbase-1.0.so.0 => /home/jetson/gst-build/build/subprojects/gstreamer/libs/gst/base/libgstbase-1.0.so.0 (0x0000007f9c6a9000)
	libgstreamer-1.0.so.0 => /home/jetson/gst-build/build/subprojects/gstreamer/gst/libgstreamer-1.0.so.0 (0x0000007f9c566000)
	libgstvideo-1.0.so.0 => /home/jetson/gst-build/build/subprojects/gst-plugins-base/gst-libs/gst/video/libgstvideo-1.0.so.0 (0x0000007f9c4b6000)
	liborc-0.4.so.0 => /home/jetson/gst-build/build/subprojects/orc/orc/liborc-0.4.so.0 (0x0000007f9bdb8000)
[gst-master] jetson@xavier:~/gst-build$ ldd /home/jetson/gst-build/build/subprojects/nvidia/gst/libgstnvvideo4linux2.so |grep gst
	libgstallocators-1.0.so.0 => /home/jetson/gst-build/build/subprojects/gst-plugins-base/gst-libs/gst/allocators/libgstallocators-1.0.so.0 (0x0000007f9c518000)
	libgstreamer-1.0.so.0 => /home/jetson/gst-build/build/subprojects/gstreamer/gst/libgstreamer-1.0.so.0 (0x0000007f9c3d5000)
	libgstvideo-1.0.so.0 => /home/jetson/gst-build/build/subprojects/gst-plugins-base/gst-libs/gst/video/libgstvideo-1.0.so.0 (0x0000007f9c325000)
	libgstbase-1.0.so.0 => /home/jetson/gst-build/build/subprojects/gstreamer/libs/gst/base/libgstbase-1.0.so.0 (0x0000007f9be00000)
	liborc-0.4.so.0 => /home/jetson/gst-build/build/subprojects/orc/orc/liborc-0.4.so.0 (0x0000007f9bd87000)
[gst-master] jetson@xavier:~/gst-build$
[gst-master] jetson@xavier:~/gst-build$ ldd /usr/lib/aarch64-linux-gnu/tegra/libnvdsbufferpool.so.1.0.0 |grep gst
	libgstreamer-1.0.so.0 => /home/jetson/gst-build/build/subprojects/gstreamer/gst/libgstreamer-1.0.so.0 (0x0000007f7ec00000)
	libgstvideo-1.0.so.0 => /home/jetson/gst-build/build/subprojects/gst-plugins-base/gst-libs/gst/video/libgstvideo-1.0.so.0 (0x0000007f7e9b1000)
	libgstbase-1.0.so.0 => /home/jetson/gst-build/build/subprojects/gstreamer/libs/gst/base/libgstbase-1.0.so.0 (0x0000007f7e5bb000)
	liborc-0.4.so.0 => /home/jetson/gst-build/build/subprojects/orc/orc/liborc-0.4.so.0 (0x0000007f7e542000)
[gst-master] jetson@xavier:~/gst-build$
[gst-master] jetson@xavier:~$ gst-launch-1.0 --version
gst-launch-1.0 version 1.17.1
GStreamer 1.17.1 (GIT)
Unknown package origin
[gst-master] jetson@xavier:~$
(python3:9099): GStreamer-CRITICAL **: 17:09:48.277: gst_buffer_resize_range: assertion 'bufmax >= bufoffs + offset + size' failed
0:00:11.153302337  9099     0x35533b20 WARN                 v4l2src gstv4l2src.c:1000:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 1 - ts: 0:00:00.543372695

(python3:9099): GStreamer-CRITICAL **: 17:09:48.283: gst_buffer_resize_range: assertion 'bufmax >= bufoffs + offset + size' failed
0:00:11.174094664  9099     0x35534540 WARN          v4l2bufferpool gstv4l2bufferpool.c:1535:gst_v4l2_buffer_pool_dqbuf:<nvv4l2h264enc0:pool:src> Driver should never set v4l2_buffer.field to ANY
(python3:9099): GStreamer-CRITICAL **: 17:09:48.332: gst_buffer_resize_range: assertion 'bufmax >= bufoffs + offset + size' failed
0:00:11.208306680  9099     0x35533b20 WARN          v4l2bufferpool gstv4l2bufferpool.c:1480:gst_v4l2_buffer_pool_dqbuf:<nvv4l2h264enc0:pool:sink> V4L2 provided buffer has bytesused 0 which is too small to include data_offset 0
0:00:11.208371257  9099     0x35533b20 WARN          v4l2bufferpool gstv4l2bufferpool.c:1480:gst_v4l2_buffer_pool_dqbuf:<nvv4l2h264enc0:pool:sink> V4L2 provided buffer has bytesused 0 which is too small to include data_offset 0
0:00:11.208417306  9099     0x35533b20 WARN          v4l2bufferpool gstv4l2bufferpool.c:1480:gst_v4l2_buffer_pool_dqbuf:<nvv4l2h264enc0:pool:sink> V4L2 provided buffer has bytesused 0 which is too small to include data_offset 0

Hi,
We would suggest use default gstreamer 1.14.5, since NVIDIA plugins are built with this version and SQA tests are performed. Upgrading to later version may not work since the deviation in header file probably causes unknown issues.

We have build instrunctions in development guide. Please take a look and see if it helps your case.

The latest bug-fix release in the 1.14 series is 1.14.5 and was released on 29 May 2019.

This release is very old and webrtc plugin we need in our project does not work with that version, we’re not doing it just for fun…

So can you please change your strict policy about your product and either offer the plugin sources (which is impossible, I know) or provide compiled binaries for all new versions, since gstreamer is officially supported.

Thank you!

1 Like

Hi,
Thanks for the suggestion. We will check and evaluate the upgrade. Since this task requires certain engineering and SQA efforts to ensure NVIDIA plugins can work fine on new gstreamer release, we would need some time. Please note this. Thanks.

1 Like

Thank you!

I also want to mention Ubuntu 20.04 has gstreamer 1.16.2 in the repo already, so making the plugins compatible would allow a very nice upgrade path for L4T in this use-case.

PS: Is it true that nvarguscamerasrc plugin sources are publicly available? Can you provide us the link?

1 Like

Hi,

It is in source code package:
https://developer.nvidia.com/embedded/L4T/r32_Release_v4.3/Sources/T210/public_sources.tbz2

This is great, thank you!

I was able to compile both libgstnvarguscamerasrc.so and libgstnvvideo4linux2.so but this error is still there:

(gst-launch-1.0:12967): GStreamer-CRITICAL **: 19:06:45.684: gst_buffer_resize_range: assertion 'bufmax >= bufoffs + offset + size' failed

Thread 6 "v4l2src0:src" received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 0x7fb24f61e0 (LWP 12974)]
raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) info stack
#0  raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000007fb7d66980 in g_logv () at /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0
#2  0x0000007fb7d66b50 in g_log () at /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0
#3  0x0000007fb7e8891c in gst_buffer_resize_range () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#4  0x0000007fb7e8c1fc in  () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#5  0x0000007fb7e8dfc8 in gst_buffer_pool_release_buffer () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#6  0x0000007fb7e86198 in  () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#7  0x0000007fb7ec25a0 in gst_mini_object_unref () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#8  0x0000007fb2e8d2ac in gst_buffer_unref () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideo4linux2.so
#9  0x0000007fb2e93690 in gst_v4l2_buffer_pool_process () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideo4linux2.so
#10 0x0000007fb2e9ea68 in gst_v4l2_video_enc_handle_frame () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideo4linux2.so
#11 0x0000007fb70924bc in  () at /usr/lib/aarch64-linux-gnu/libgstvideo-1.0.so.0
#12 0x0000007fb7ec6208 in  () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#13 0x0000007fb7ec7e10 in  () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#14 0x0000007fb7ecf374 in gst_pad_push () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#15 0x0000007fb6ff72d4 in  () at /usr/lib/aarch64-linux-gnu/libgstbase-1.0.so.0
#16 0x0000007fb7ec6208 in  () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#17 0x0000007fb7ec7e10 in  () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#18 0x0000007fb7ecf374 in gst_pad_push () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#19 0x0000007fb7fb7648 in  () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstvideorate.so
#20 0x0000007fb6ff78c4 in  () at /usr/lib/aarch64-linux-gnu/libgstbase-1.0.so.0
#21 0x0000007fb6ff71cc in  () at /usr/lib/aarch64-linux-gnu/libgstbase-1.0.so.0
#22 0x0000007fb7ec6208 in  () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#23 0x0000007fb7ec7e10 in  () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#24 0x0000007fb7ecf374 in gst_pad_push () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#25 0x0000007fb6ff72d4 in  () at /usr/lib/aarch64-linux-gnu/libgstbase-1.0.so.0
#26 0x0000007fb7ec6208 in  () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#27 0x0000007fb7ec7e10 in  () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#28 0x0000007fb7ecf374 in gst_pad_push () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#29 0x0000007fb6ff2cf4 in  () at /usr/lib/aarch64-linux-gnu/libgstbase-1.0.so.0
#30 0x0000007fb7f016fc in  () at /usr/lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#31 0x0000007fb7d898f8 in  () at /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0
#32 0x0000007fb7d88f64 in  () at /usr/lib/aarch64-linux-gnu/libglib-2.0.so.0
#33 0x0000007fb7c744fc in start_thread (arg=0x7fffffdedf) at pthread_create.c:477
#34 0x0000007fb7bcef2c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78
(gdb)

Can it be that the error is hard-linked in libnvdsbufferpool.so? Is this one open source too?

@DaneLLL I’m also interested in running the latest gstreamer version (1.17.2) and I’m wondering if there’s a plan to upgrade the plugins?

Hi,

Please check this post.

Gstreamer maintainers responded here: tests: bufferpool test fails on 32-bit (#316) · Issues · GStreamer / gstreamer · GitLab

It seems the bug is triggered by nvidia plugin misusing the buffer parameter.

@DaneLLL According to the GStreamer maintainers as per the link shared above there is a bug in libgstnvvideo4linux2. Could you confirm if there is the intention to fix it?

Hi,

We don’t actually have clear steps to reproduce the error. If you can reproduce it on r32.4.3(Jetpack4.4), please share the steps so that we can do further check.

The error can be reproduced with gstreamer 1.16 and nvidia plugins like h264 encoder.

Developers should have all the technical details in the MR, including a new added warning in gstreamer core especially for this: gst/bufferpool: only resize in reset when maxsize is larger (!570) · Merge requests · GStreamer / gstreamer · GitLab

Please note that in the way the buffer is used by nvidia plugin, currently there is a performance penalty because of not properly reusing it.

Hi,
Thanks for the information. As of now the BSP is with gstreamer 1.14. We will check this when we upgrade to newer gstreamer release.

@razvan.grigore

We recently need to move to gstreamer 1.16.2 as well, did you find a way to overcome the gst_buffer_resize_range issue?