Random access violation (seg. fault) when calling GStreamer functions from MATLAB context in Windows

Marc Gelinas mgelinas at kinova.ca
Tue Feb 5 21:43:04 UTC 2019


Hello,

I wonder if anyone has ever been able to use GStreamer libraries with
MATLAB in Windows.

Context
-------
We are developing a custom adapter to be used with MATLAB's Image
Acquisition Toolbox add-on library (imaqmex.mexw64). Our adapter is a
library (.dll in Windows) and uses GStreamer to access an RTSP video feed.

MATLAB --> imaqmex.mexw64 --> our_custom_adapter.dll --> gstreamer libraries

The components are:
- Windows 7
- MATLAB R2018b (v9.5.0.944444) with Image Acquisition Toolbox v5.5
- GStreamer libraries v1.14.4 for Windows
- Visual Studio 2015 (because it appears that the imaqmex.mexw64 was built
with VS 2015).


Issue
-----
At some point in MATLAB's Command Window, we type 'imaqhwinfo'. This
results in the Image Acquisition Toolbox library calling our adapter's
initialization code, which in turn calls gst_init_check(), after checking
that it's not already initialized (i.e. gst_is_initialized).

Then, somewhere along the line, an access violation (segmentation fault)
randomly occurs in a GStreamer function (doesn't always occur when calling
the same function). I have noticed that it often occurs when "calling"
GST_LOG or GST_DEBUG macros, but it can also occur when calling any other
function. For instance, calling gst_tag_register from plugin_init
(isomp4-plugin.c).

It looks like there's an alignment issue between the MATLAB context and the
GStreamer libraries.

I've tried to change multiple compiler and linker options but I didn't find
any combination to make it work.

- Does anyone have any idea what could be the issue and how to fix it?
- Is it just a question of setting the proper compiler/linker options or
it's more complex than that?

It must be noted that with Linux, the same code (obviously with appropriate
#ifdef/#ifndef _WIN32 where required) works without any issues.


Finally, in the GStreamer instructions for Installing on Windows
<https://gstreamer.freedesktop.org/documentation/installing/on-windows.html#installing-on-windows>,
it's said that the property pages only work with Visual Studio 2010. What
do we need to change to make them work with Visual Studio 2015? I didn't
face any issue loading them in Visual Studio 2015.


Thank you in advance for any help, it will be greatly appreciated.

Regards,
MarcG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190205/d7767535/attachment-0001.html>


More information about the gstreamer-devel mailing list