basler / gst-plugin-pylon

The official GStreamer plug-in for Basler cameras
BSD 3-Clause "New" or "Revised" License
42 stars 10 forks source link

Compression Beyond support #98

Open kostastsing opened 7 months ago

kostastsing commented 7 months ago

Describe the bug I have enabled the feature Compression Beyond in the camera (a2A1920-51gcPRO) with lossless compression-ratio at 85%. The following pipeline exits with Segmentation Fault. I provide the stacktrace below:

Starting program: /usr/bin/gst-launch-1.0 pylonsrc pfs-location=a2A1920-51gcPRO_40104514_50fps_compression85.pfs \! video/x-bayer,width=1920,height=1000,framerate=50/1,format=rggb \! bayer2rgb \! videoconvert \! queue \! autovideosink
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
[New Thread 0xfffff25bf0e0 (LWP 30632)]
[New Thread 0xfffff1daf0e0 (LWP 30633)]
[New Thread 0xfffff159f0e0 (LWP 30644)]
[Thread 0xfffff159f0e0 (LWP 30644) exited]
[New Thread 0xfffff159f0e0 (LWP 30645)]
[Detaching after fork from child process 30646]
[New Thread 0xfffff0d8f0e0 (LWP 30647)]
[Thread 0xfffff159f0e0 (LWP 30645) exited]
[Thread 0xfffff0d8f0e0 (LWP 30647) exited]
[New Thread 0xfffff0d8f0e0 (LWP 30667)]
[Thread 0xfffff0d8f0e0 (LWP 30667) exited]
[New Thread 0xfffff0d8f0e0 (LWP 30670)]
[Detaching after fork from child process 30671]
[New Thread 0xfffff159f0e0 (LWP 30672)]
[Thread 0xfffff0d8f0e0 (LWP 30670) exited]
[Thread 0xfffff159f0e0 (LWP 30672) exited]
Error while mapping shared library sections:
`/opt/pylon/lib': not in executable format: file format not recognized
Setting pipeline to PAUSED ...
[New Thread 0xfffff159f0e0 (LWP 30682)]
[Thread 0xfffff159f0e0 (LWP 30682) exited]
[New Thread 0xfffff159f0e0 (LWP 30683)]
[New Thread 0xfffff0d8f0e0 (LWP 30684)]
[New Thread 0xffffe3fff0e0 (LWP 30685)]
[Thread 0xffffe3fff0e0 (LWP 30685) exited]
[New Thread 0xffffe3fff0e0 (LWP 30686)]
[Detaching after fork from child process 30687]
[New Thread 0xffffe37ef0e0 (LWP 30688)]
[New Thread 0xffffe2fdf0e0 (LWP 30689)]
Pipeline is live and does not need PREROLL ...
[New Thread 0xffffe27cf0e0 (LWP 30690)]
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
[New Thread 0xffffe1fbf0e0 (LWP 30707)]
[New Thread 0xffffe17af0e0 (LWP 30708)]
[New Thread 0xffffe0f9f0e0 (LWP 30709)]
[New Thread 0xffffd2eda0e0 (LWP 30710)]
[New Thread 0xffffd26ca0e0 (LWP 30711)]

Thread 16 "pylonsrc0:src" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xffffe2fdf0e0 (LWP 30689)]
BFD: reopening /tmp/shared.etlTrn: No such file or directory

BFD: reopening /tmp/shared.etlTrn: No such file or directory

BFD: reopening /tmp/shared.etlTrn: No such file or directory

warning: Can't read data for section '.eh_frame' in file '/tmp/shared.etlTrn'
0x0000fffff0561a80 in ?? () from /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstbayer.so
(gdb) bt
#0  0x0000fffff0561a80 in  () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstbayer.so
#1  0x0000fffff05624e4 in  () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstbayer.so
#2  0x0000fffff05625f8 in  () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstbayer.so
#3  0x0000fffff0564304 in  () at /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstbayer.so
#4  0x0000fffff5feb8b4 in  () at /lib/aarch64-linux-gnu/libgstbase-1.0.so.0
#5  0x0000fffff5feac5c in  () at /lib/aarch64-linux-gnu/libgstbase-1.0.so.0
#6  0x0000fffff7ed4978 in  () at /lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#7  0x0000fffff7ed7bb8 in  () at /lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#8  0x0000fffff7ed7fe8 in gst_pad_push () at /lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#9  0x0000fffff5fead6c in  () at /lib/aarch64-linux-gnu/libgstbase-1.0.so.0
#10 0x0000fffff7ed4978 in  () at /lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#11 0x0000fffff7ed7bb8 in  () at /lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#12 0x0000fffff7ed7fe8 in gst_pad_push () at /lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
#13 0x0000fffff5fee9c0 in  () at /lib/aarch64-linux-gnu/libgstbase-1.0.so.0
#14 0x0000fffff7f0070c in  () at /lib/aarch64-linux-gnu/libgstreamer-1.0.so.0
--Type <RET> for more, q to quit, c to continue without paging--
#15 0x0000fffff7d77658 in  () at /lib/aarch64-linux-gnu/libglib-2.0.so.0
#16 0x0000fffff7d74980 in  () at /lib/aarch64-linux-gnu/libglib-2.0.so.0
#17 0x0000fffff7b3d5c8 in start_thread (arg=0x0) at ./nptl/pthread_create.c:442
#18 0x0000fffff7ba5edc in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:79

However, when I run the pipeline with C code, I am not getting a segmentation fault but the following error instead that causes the pipeline to terminate.

GStreamer-Base-WARNING **: 20:11:00.148: bayer2rgb: size 1632000 is not a multiple of unit size 1920000
0:00:07.182515536 29145 0xaaaadb306380 ERROR           streamer.cpp:60:bus_call: ERROR from element src_elem: Internal data stream error.

0:00:07.182556336 29145 0xaaaadb306380 ERROR           streamer.cpp:63:bus_call: Error details: ../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:streamer-pipeline/GstBin:src_bin_0/GstPylonSrc:src_elem:
streaming stopped, reason error (-5)

From the error message, I can understand that the incoming data to the bayer2rgb element do not have the expected size when compression beyond is enabled. How to resolve this issue? Thanks in advance!

To Reproduce gst-launch-1.0 pylonsrc pfs-location=a2A1920-51gcPRO_40104514_50fps_compression85.pfs ! "video/x-bayer,width=1920,height=1000,framerate=50/1,format=rggb" ! bayer2rgb ! videoconvert ! queue ! autovideosink

Environment

thiesmoeller commented 7 months ago

Currently looking into supporting CompressionBeyond in the plugin.

We have to give up the optimization to directly cycle the pylon capture buffers in the gstreamer pipeline for this. ... and track the state of the ImageCompressonMode feature, to setup the buffer management accordingly

m-binev commented 7 months ago

@kostastsing Hi, may we connect e.g. via LinkedIn and have a short chat on that? My ID is: www.linkedin.com/in/momchil-binev-380479145