Freescale / gstreamer-imx

GStreamer 1.0 plugins for i.MX platforms
Other
183 stars 127 forks source link

Buffer assertion failed: (buf) when camera pipeline is switched ! #185

Closed ranaya123 closed 3 years ago

ranaya123 commented 6 years ago

Hi all, We have developed an OpenGL application which uses imxv4l2videosrc for camera pipelines. We utilize a camera through parallel CSI interface and a tw6869 capture card through pcie bus. In the application, there is a drop down menu to switch the camera input of interest. Pipelines of cameras as follows :

for csi camera -> gst-launch-1.0 imxv4l2videosrc device=/dev/video0 ! video/x-raw,format=(string)UYVY ! appsink for tw6869 -> gst-launch-1.0 imxv4l2videosrc device=/dev/video0 queue-size=24 ! video/x-raw,format=(string)UYVY ! appsink

when switching camera input at a moderate rate of speed, the application ends up having a segmentation fault and following error : ERROR:../src/v4l2video/v4l2_buffer_pool.c:283:gst_imx_v4l2_buffer_pool_acquire_buffer: assertion failed: (buf)

gdb core and backtrace report : [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". Core was generated by `osd_Release_For_NewGst_ExtQsize'. Program terminated with signal SIGABRT, Aborted.

0 __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47

47 pop {r7, pc} [Current thread is 1 (Thread 0x60d86450 (LWP 24011))] (gdb) bt

0 __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47

1 0x761b350c in __libc_signal_restore_set (set=0x60d85860) at /usr/src/debug/glibc/2.25-r0/git/sysdeps/unix/sysv/linux/nptl-signals.h:79

2 __GI_raise (sig=sig@entry=6) at /usr/src/debug/glibc/2.25-r0/git/sysdeps/unix/sysv/linux/raise.c:48

3 0x761b41fa in __GI_abort () at /usr/src/debug/glibc/2.25-r0/git/stdlib/abort.c:89

4 0x767d915a in g_assertion_message () from /usr/lib/libglib-2.0.so.0

5 0x767d91e4 in g_assertion_message_expr () from /usr/lib/libglib-2.0.so.0

6 0x68742050 in ?? () from /usr/lib/gstreamer-1.0/libgstimxv4l2video.so

Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb)

Can anyone show me an insight to this ? Anuradha

ranaya123 commented 6 years ago

I think the issue triggers in : g_assert(buf) at gst_imx_v4l2_buffer_pool_acquire_buffer() This only occurs when camera source is switched ! Can anyone help me to figure this out ?

dv1 commented 6 years ago

Can you produce a small test code that replicates the problem?

Also, what hardware do you use? I do have an avc8000nano card, but I have no board that has both a mini PCIe connector and a parallel CSI camera.

dierberg commented 6 years ago

Why not trying my patch at #171? I am shure there is still a problem within buffer handling.

sgd3431 commented 6 years ago

@ranaya123 Did you solved this problem? I also encounter the same problem,I have two cameras, one through parallel CSI interface connected with ov5642, another through mipi CSI interface with ov5640. I developed an applicationtwo with qt using imxv4l2videosrc for camera source on imx6q platform and two cameras with different resolution, when switching the camera input error occurs occasionally : ERROR:../src/v4l2video/v4l2_buffer_pool.c:283:gst_imx_v4l2_buffer_pool_acquire_buffer: assertion failed: (buf).

dierberg commented 6 years ago

My patch is still working very well but not integrated in master branch.

sgd3431 commented 6 years ago

@dierberg I patched your patch, but nothing changed, right now i use 0.12.2-r0 version ,should I change to the newest version? I build the plugins in yocto with Krogoth

sgd3431 commented 6 years ago

@dierberg I changed the plugins to the newest version in master branch, but the same error! ERROR imxv4l2bufferpool v4l2_buffer_pool.c:318:gst_imx_v4l2_buffer_pool_release_buffer: VIDIOC_QBUF error: Invalid argument ERROR:../src/v4l2video/v4l2_buffer_pool.c:282:gst_imx_v4l2_buffer_pool_acquire_buffer: assertion failed: (buf)

dierberg commented 6 years ago

Sorry but then you may run in another bug. Be careful if you use imx-decoders/encoders with dynamic changes without stopping the pipeline. Or what do you mean with "switching camera pipelines"?

ranaya123 commented 6 years ago

@sgd3431 Hi, unfortunately I am not working on that project anymore. However I remember that the issue did persist for even two pci cameras. Updating the imx-gstreamer didn't help either ! And we had some improvements in the application level though. Which kernel are you using ?

sgd3431 commented 6 years ago

@ranaya123 Hi,I use linux-fslc-imx 4.1-1.0.x-imx kernel, and could you tell me what improvements did you make in the application level, thanks!

sgd3431 commented 6 years ago

@dierberg I have a input-selector element in the pipeline, which make two cameras with imxv4l2videosrc capturing as it's "src", and dynamically switch one camera to output. When I do this, I stop the pipeline and build it again, and I don't use any imx-decoders/encoders in the pipeline.