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

Marc Gelinas mgelinas at kinova.ca
Tue Mar 12 21:21:12 UTC 2019


Thank you Nirbheek for the quick reply and for the good news regarding
GStreamer 1.15.2 libraries built with MSVC.

I was very eager to try them out with MATLAB, here's the status.

At first, I had the following issue, but it seems to have been resolved
"magically".

ISSUE: I was not able to start the video streams from my DLL.

Using a custom log function (ref. VisionAdaptor::printGstLog), I had the
following output in MATLAB command window:
gstreamer: [ERROR] ../gst/parse/grammar.y:816:priv_gst_parse_yyparse: no
element "rtspsrc"
gstreamer: [ERROR] ../gst/parse/grammar.y:816:priv_gst_parse_yyparse: no
element "rtph264depay"
gstreamer: [ERROR] ../gst/parse/grammar.y:901:priv_gst_parse_yyparse: link
has no source [sink=@0000000000000000]
gstreamer: [ERROR] ../gst/parse/grammar.y:816:priv_gst_parse_yyparse: no
element "avdec_h264"
gstreamer: [ERROR] ../gst/parse/grammar.y:901:priv_gst_parse_yyparse: link
has no source [sink=@0000000000000000]
gstreamer: [ERROR] ../gst/parse/grammar.y:816:priv_gst_parse_yyparse: no
element "videoconvert"
gstreamer: [ERROR] ../gst/parse/grammar.y:901:priv_gst_parse_yyparse: link
has no source [sink=@0000000000000000]

The VisionAdaptor::printGstLog function uses a printf-like function with
this format:
"gstreamer: [%s] %s:%d:%s: %s", GST_LOG_LEVEL_NAME[level], file, line,
function, gst_debug_message_get(message)

After confirming that I was able to stream my video feed with gst-launch
(using the same pipeline), the issue was "fixed" when I tried again to
stream from my DLL. The issue never came back.

Unfortunately, I still have the following issue:

ISSUE: A few seconds after MATLAB unloads my DLL, sometimes it crashes with
the following backtrace:
Stack Trace (from fault):
[  0] 0x00000000d32924c0
 <unknown-module>+00000000
[  1] 0x000007fec1104bf3
C:\gstreamer\1.0\x86_64\bin\gstreamer-1.0-0.dll+00347123
gst_value_init_and_copy+00333927
[  2] 0x000007fec110418d
C:\gstreamer\1.0\x86_64\bin\gstreamer-1.0-0.dll+00344461
gst_value_init_and_copy+00331265
[  3] 0x000007fec1637a88
C:\gstreamer\1.0\x86_64\bin\gstrtsp-1.0-0.dll+00031368
gst_rtsp_message_steal_body+00026102
[  4] 0x000007fec1eb3032
C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\gstrtsp.dll+00012338
gst_plugin_rtsp_register+00007882
[  5] 0x000007fec1ec4db8
C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\gstrtsp.dll+00085432
gst_plugin_rtsp_register+00080976
[  6] 0x000007fec1ebe50c
C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\gstrtsp.dll+00058636
gst_plugin_rtsp_register+00054180
[  7] 0x000007fec1eb8c82
C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\gstrtsp.dll+00035970
gst_plugin_rtsp_register+00031514
[  8] 0x000007fec1ec0af1
C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\gstrtsp.dll+00068337
gst_plugin_rtsp_register+00063881
[  9] 0x000007fec1ecccaf
C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\gstrtsp.dll+00117935
gst_plugin_rtsp_register+00113479
[ 10] 0x000007fec115320c
C:\gstreamer\1.0\x86_64\bin\gstreamer-1.0-0.dll+00668172
gst_value_init_and_copy+00654976
[ 11] 0x000007feb3d8b0f4
 C:\gstreamer\1.0\x86_64\bin\glib-2.0-0.dll+00438516
g_date_get_monday_week_of_year+00425260
[ 12] 0x000007feb3d8a3f6
 C:\gstreamer\1.0\x86_64\bin\glib-2.0-0.dll+00435190
g_date_get_monday_week_of_year+00421934
[ 13] 0x000007feb3db32f7
 C:\gstreamer\1.0\x86_64\bin\glib-2.0-0.dll+00602871
g_date_get_monday_week_of_year+00589615
[ 14] 0x000007fec9b80369 C:\Program
Files\MATLAB\R2018b\bin\win64\ucrtbase.DLL+00131945 o__strtoui64+00000089
[ 15] 0x00000000773f59cd
 C:\windows\system32\kernel32.dll+00088525 BaseThreadInitThunk+00000013
[ 16] 0x000000007755383d
C:\windows\SYSTEM32\ntdll.dll+00342077 RtlUserThreadStart+00000029

The crash seems to occur only if previously I had a failed attempt to
stream a video feed. For instance, I specify a wrong IP address for the
rtspsrc. Then, when I make MATLAB unload my DLL, the crash occurs after a
few seconds. Do you have any idea what could be the root cause?

Also, do you know if the release of stable version 1.16 is still planned
for this month?

Thank you,
MarcG

---------- Forwarded message ----------
> From: Nirbheek Chauhan <nirbheek.chauhan at gmail.com>
> To: Discussion of the development of and with GStreamer <
> gstreamer-devel at lists.freedesktop.org>
> Cc:
> Bcc:
> Date: Tue, 12 Mar 2019 17:28:13 +0530
> Subject: Re: gstreamer-devel Digest, Vol 97, Issue 63
> On Tue, Mar 12, 2019 at 5:11 PM Marc Gelinas <mgelinas at kinova.ca> wrote:
> > Would it be possible for me then to build GStreamer with MSVC?
>
> You can do this starting with the 1.15.2 development release:
>
>
> https://gitlab.freedesktop.org/gstreamer/cerbero/#enabling-visual-studio-support
>
> > Any caveats?
>
> Some plugins are disabled, and only x86_64 is currently available. For
> more details, see:
>
> https://gitlab.freedesktop.org/gstreamer/cerbero/issues/121
>
> > Any plans in the very near future for the GStreamer team to provide
> libraries built with MSVC?
>
> The 1.15.2 release shipped with x86_64 binaries built with MSVC:
>
> https://gstreamer.freedesktop.org/data/pkg/windows/1.15.2/
>
> Cheers,
> Nirbheek
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190312/7bc3b5fb/attachment-0001.html>


More information about the gstreamer-devel mailing list