gstreamer-sharp: Fix App{Src,Sink} constructors
authorJakub Adam <jakub.adam@collabora.com>
Mon, 6 Jul 2020 21:15:22 +0000 (23:15 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 8 Mar 2022 12:01:13 +0000 (12:01 +0000)
commit38a3af96d0e70c103b6be91e32b0bd38da6eddc9
treea3b14d4690ef3e3693917219a4a6f26d0cd34637
parent95ff949eff70d5fd9f84e3f7e9546f03d91106f1
gstreamer-sharp: Fix App{Src,Sink} constructors

Apparently GtkSharp expects each object has only one ToggleRef at any
time. Assigning element.Handle into Raw has a consequence that second
ToggleRef attempts to get created but fails on g_object_unref () that
breaks a GObject assertion:

  toggle_refs_notify: assertion failed: (tstack.n_toggle_refs == 1)

This is because toggle references should be removed with
g_object_remove_toggle_ref(), not a simple unref().

In order to avoid duplicate toggle references, introduce
ElementFactory.MakeRaw(), which creates a GstElement without its
accompanying C# object. The returned raw pointer can be assigned into
another GLib.Object without trouble.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1885>
subprojects/gstreamer-sharp/sources/custom/AppSink.cs
subprojects/gstreamer-sharp/sources/custom/AppSrc.cs
subprojects/gstreamer-sharp/sources/custom/ElementFactory.cs [new file with mode: 0644]
subprojects/gstreamer-sharp/sources/meson.build