After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 796730 - A bug in DynamicSignal.Emit for webrtcbin
A bug in DynamicSignal.Emit for webrtcbin
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-sharp
1.14.1
Other Windows
: Normal major
: 1.15.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-07-01 20:55 UTC by tomislavtustonic
Modified: 2018-07-03 15:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A bug repro. (687 bytes, text/plain)
2018-07-01 20:55 UTC, tomislavtustonic
Details

Description tomislavtustonic 2018-07-01 20:55:46 UTC
Created attachment 372906 [details]
A bug repro.

Hello

I'm trying to implement the WebRtc demo (https://github.com/centricular/gstwebrtc-demos/blob/master/sendrecv/gst/webrtc-sendrecv.py) in C#, and I have encountered the AccessViolationException when trying to emit a signal from the webrtcbin.

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at GLib.GType.g_type_name(IntPtr raw)
   at GLib.GType.LookupType(IntPtr typeid)
   at Gst.DynamicSignal.Emit(Object o, String name, Object[] parameters)
   at Gst.Object.Emit(String signal, Object[] parameters)
   at ConsoleApp1.Program.Main(String[] args) in \Program.cs:line 16

It seems that the type ID obtained in the call (DynamicSignal.cs, line 383)

IntPtr t = Marshal.ReadIntPtr (q.param_types, i);

is invalid and it throws in the line 389 (casting to Type, which calls LookupType in GLib).

I tried with the glib-sharp which is a part of gstreamer-sharp Nuget package, and the GLibSharp from the Nuget package https://www.nuget.org/packages/GLibSharp/3.22.24.36/
Comment 1 Thibault Saunier 2018-07-02 14:56:02 UTC
First you will need my webrtc branch to use GstWebRTC with gst-sharp: https://github.com/thiblahute/gstreamer-sharp/tree/webrtc

Could you share your code to see what you are doing exactly? I would like to add a c# example to gstwebrtc-demo :-)

I have the impression that particular bug was fixed in master, please check with my webrtc branch and let me know.
Comment 2 tomislavtustonic 2018-07-03 03:09:31 UTC
Yes, it works! 
I believe that you need

GLib.GType.Register(Gst.WebRTC.WebRTCSessionDescription.GType, typeof(Gst.WebRTC.WebRTCSessionDescription));

somewhere in GtkSharp.GstreamerSharp.ObjectManager.Initialize

As for the code, here it is:
https://github.com/ttustonic/GStreamerSharpSamples

These are my versions of tutorials, some tests for web cameras, WinForms and WPF demos, WebRtc sample (in GstSamples dir), so enjoy.

Cheers, Tom
Comment 3 Thibault Saunier 2018-07-03 03:18:07 UTC
Nice, not sure why the type registration didn't get generated, I will check.

Could you propose the webrtc example to gstwebrtc-demo? If you can't would you mind if I do?
Comment 4 tomislavtustonic 2018-07-03 03:20:14 UTC
Go ahead.
Comment 5 Thibault Saunier 2018-07-03 15:29:25 UTC
Proposed upstream https://github.com/centricular/gstwebrtc-demos/pull/32

Thanks a lot for your work :-)

Closing now.