[gst-cvs] gst-plugins-base: audiosink, audiosrc: ref the audio ring buffer class and type in class_init
Tim Mueller
tpm at kemper.freedesktop.org
Mon Jun 15 07:50:37 PDT 2009
Module: gst-plugins-base
Branch: master
Commit: 3767cb60053eb12d346c815fbe695a1d2ec265b0
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=3767cb60053eb12d346c815fbe695a1d2ec265b0
Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date: Mon Jun 15 15:39:09 2009 +0100
audiosink,audiosrc: ref the audio ring buffer class and type in class_init
Hack around thread-safety issues in GObject and our racy _get_type()
functions (we could easily fix the _get_type() functions, but we still
need to hack around the GObject class races until we require a newer
GLib version, I think).
---
gst-libs/gst/audio/gstaudiosink.c | 4 ++++
gst-libs/gst/audio/gstaudiosrc.c | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/gst-libs/gst/audio/gstaudiosink.c b/gst-libs/gst/audio/gstaudiosink.c
index b4ceacb..479267e 100644
--- a/gst-libs/gst/audio/gstaudiosink.c
+++ b/gst-libs/gst/audio/gstaudiosink.c
@@ -191,6 +191,10 @@ gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass)
gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_audioringbuffer_delay);
gstringbuffer_class->activate =
GST_DEBUG_FUNCPTR (gst_audioringbuffer_activate);
+
+ /* ref class from a thread-safe context to work around missing bit of
+ * thread-safety in GObject */
+ g_type_class_ref (GST_TYPE_AUDIORING_BUFFER);
}
typedef guint (*WriteFunc) (GstAudioSink * sink, gpointer data, guint length);
diff --git a/gst-libs/gst/audio/gstaudiosrc.c b/gst-libs/gst/audio/gstaudiosrc.c
index 8974e23..ff183b8 100644
--- a/gst-libs/gst/audio/gstaudiosrc.c
+++ b/gst-libs/gst/audio/gstaudiosrc.c
@@ -183,6 +183,10 @@ gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass)
gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_audioringbuffer_stop);
gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_audioringbuffer_delay);
+
+ /* ref class from a thread-safe context to work around missing bit of
+ * thread-safety in GObject */
+ g_type_class_ref (GST_TYPE_AUDIORING_BUFFER);
}
typedef guint (*ReadFunc) (GstAudioSrc * src, gpointer data, guint length);
More information about the Gstreamer-commits
mailing list