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).
This commit is contained in:
Tim-Philipp Müller 2009-06-15 15:39:09 +01:00
parent a5491ba218
commit 3767cb6005
2 changed files with 8 additions and 0 deletions

View file

@ -191,6 +191,10 @@ gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass)
gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_audioringbuffer_delay); gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_audioringbuffer_delay);
gstringbuffer_class->activate = gstringbuffer_class->activate =
GST_DEBUG_FUNCPTR (gst_audioringbuffer_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); typedef guint (*WriteFunc) (GstAudioSink * sink, gpointer data, guint length);

View file

@ -183,6 +183,10 @@ gst_audioringbuffer_class_init (GstAudioRingBufferClass * klass)
gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_audioringbuffer_stop); gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_audioringbuffer_stop);
gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_audioringbuffer_delay); 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); typedef guint (*ReadFunc) (GstAudioSrc * src, gpointer data, guint length);