Porting jetson libs to new linux version issues

Ok, so probably not an issue I expect to get a ton of support for, but I have been working on porting jetson libs to libreelec. For the most part it all works(Vulkan, X, …) at leas the parts I need. Small problem when trying to get the decoder to work with ffmeg, which doesnt happen in ubuntu…

If I modify NVV4lElementPlane.cpp then I can get jetson-ffmpeg(nvmpi) lib to work, but it crashes on decoder close, with a double free or corruption out issue. Without modified nvv4lElementPlane.cpp, the decoder doesnt start, due to issue in deinitPlane function.

If I use nvv4l2dec all I get is a segfault on decoder open.

any thoughts on libs that have to be in aarch64-linux-gnu/{tegra, tegra-egl} I did find that libv4l extensions must follow this path, but the rest of the libs are a bit of a mystery to me…

here is how I am installing bsp libs, note this is still rough and still needs support for other L4T devices added. Lakka-LibreELEC/package.mk at Lakka-v4.x-new-jetson-ffmpeg-patches · GavinDarkglider/Lakka-LibreELEC · GitHub

Here is modified NvV4LElementPlane.cpp That works with nvmpi lib, but has issues on decoder close.

I would just dump the libs the way they are in ubuntu, which has worked in other distro ports(Arch, and fedora), but there is no way to run ldconfig in lakka/libreelec, as it is a squashfs system image, with minimal tools(no ldconfig, even if linker cache could be updated)

Any thoughts on fixing these lib issues(As from what I can tell that is where the problem is) or a new directions to look in would be helpful.

gdb output from ffmpeg with libnvmpi:

Thread 11 "retroarch" received signal SIGABRT, Aborted. [Switching to Thread 0x7f70424f70 (LWP 4916)] __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49 49 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49 #1 0x0000007f7858cf74 in __GI_abort () at abort.c:79 #2 0x0000007f785d7c44 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7f78691c90 "%s\n") at ../sysdeps/posix/libc_fatal.c:155 #3 0x0000007f785df68c in malloc_printerr (str=str@entry=0x7f7868d678 "free(): invalid pointer") at malloc.c:5389 #4 0x0000007f785e179c in free_check (mem=0x13a8fd0, caller=<optimized out>) at hooks.c:255 #5 0x0000007f7792bc90 in NvDdkVicFreeSession () from /usr/lib/libnvddk_vic.so #6 0x0000007f77cd1174 in NvBufferSessionDestroy () from /usr/lib/libnvbuf_utils.so.1.0.0 #7 0x0000007f7802aa00 in dec_capture_loop_fcn (arg=0xedebc0) at ../nvmpi_dec.cpp:316 #8 0x0000007f78881ddc in std::execute_native_thread_routine (__p=0xfbd2e0) at /home/gavin/Lakka-LibreELEC/build.Lakka-Switch.aarch64/build/gcc-10.2.0/libstdc++-v3/src/c++11/thread.cc:80 #9 0x0000007f7a366f14 in start_thread (arg=0x0) at pthread_create.c:463 #10 0x0000007f78639e1c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78

and I will post output of nv4l2_dec codec once I have built a proper debug build for that.

Hi,
Please refer to developer guide and follow it for the implementation.

FYR, here is a post about building the source code:
Jetson TX2 and FFmpeg - Can't initialize nvrm channel - #5 by DaneLLL

Thank you for your response, but this doesnt really apply, since I already have all of this, and all the nvv4l2dec does is segfault in ffmpeg on my distro I am building. I am not using ubuntu as a base system, or any debian based system. I am using LibreELEC which is a stripped down distribution for media centers. The last piece of the puzzle is working out the decoder stuff, which seems to crash in the nvidia libs. I have narrowed this down to the way something else is compiled, but since I dont have the info needed to debug, as the libs dont spit out anything other than the functions being called in the lib that the error occurs, I am at a bit of a loss.

for example with nvv4l2 decoder, I have been able to trace the issue to this line. https://gitlab.com/switchroot/switch-l4t-multimedia/FFmpeg/-/blob/4.4-l4t/libavcodec/nvv4l2_dec.c#L928

The moment it calls NVBuffer it segfaults, and since I cant see what is happening in that function, I have no idea where to even look.

Hi,
Please check if you put the jetson_multimedia_api samples in

/usr/src/jetson_multimedia_api

And can run 00_video_decode and 01_video_encode samples successfully. The ffmpeg package is based on jetson_multimedia_api. Please make sure the samples can be built/run successfully.

Ok, so upon further research with gdb, where I basically started dumping values getting passed to libs, to find out that my compiler (GCC 10.x) is optimizing out variables that dont have a value set when they are defined. Got it kind of working using nvv4l2 decoder, now to figure out the next issue, which is about 10 minutes in the stream crashes.

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