Freescale / gstreamer-imx

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

Application crash during display camera live with overlay text and image #272

Closed jigneshpatel47 closed 4 years ago

jigneshpatel47 commented 4 years ago

Hi,

I am facing the issue of C++ application getting crashed (1 time out of 5 on power off/on the instrument) when I am playing GStreamer pipeline with overlay text and image. below is my source for pipeline and also where my application getting crashed.

void StartCameraWithOverlay() { gst_init (NULL, NULL); QString sCapture = "imxv4l2videosrc device=/dev/video0 fps-n=30 imx-capture-mode=0 ! textoverlay name=overlay text=\"Overlaytext here\" valignment=top halignment=left font-desc=\"Sans, 22\" shaded-background=true ! gdkpixbufoverlay name=imageoverlay location=/home/user/CamOverlay.png offset-x=220 offset-y=190 " IMAGE_OVERLAY " ! imxg2dvideotransform ! imxg2dvideosink framebuffer=/dev/fb1 use-vsync=true sync=false";

pipeline =  gst_parse_launch(sCapture.toStdString().c_str(), NULL);

GstStateChangeReturn setstate = gst_element_set_state (pipeline, GST_STATE_PLAYING); // return 2 means GST_STATE_CHANGE_ASYNC
/* wait until it's up and running or failed */
GstStateChangeReturn getstate = gst_element_get_state (pipeline, NULL, NULL, -1); //Application getting crashed here first time when powered on.

}

some times i am getting below error during crash: Alignment trap: not handling instruction f4024aef at [<67bf02fc>] Unhandled fault: alignment exception (0x811) at 0x720519a8 pgd = a9508000 [720519a8] pgd=38d37831, pte=3134775f, *ppte=31347c7f

It's very hard to debug this crash and not able to find out the issue.

Please help me how to debug it or prevent the crash and is there any way to catch this exception in C++?

I am using im6 dualite SOM with Debian stretch 9.5 with Linux kernel 4.9.88.

Thanks, Jignesh

jigneshpatel47 commented 4 years ago

Crashing happen because of the mixing of pipeline imx plugins and GStreamer good plugins. If I remove the overlay image pipeline and use textoverlay application get crash but by using "imxg2dtextoverlay" it works fine. below pipeline works fine: "gst-launch-1.0 imxv4l2videosrc ! imxg2dvideotransform ! imxg2dtextoverlay name=overlay text=\"Overlay text here\" valignment=top halignment=left font-desc=\"Sans, 22\" ! imxipuvideotransform ! imxipuvideosink"

Can anyone help me understand why this happens?

Thanks, Jignesh Patel