summaryrefslogtreecommitdiff
path: root/gst/frei0r
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-02-27 19:08:49 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-03-09 21:05:50 +0000
commit125efbffcc72e53bad3921d0e60b92c4e0f67859 (patch)
treee06719694c0e55c69cc2d76665dc851d38ef64cd /gst/frei0r
parent678f7ddb16e99deb1fb08913302dfa82c118ab9f (diff)
downloadgstreamer-plugins-bad-125efbffcc72e53bad3921d0e60b92c4e0f67859.tar.gz
frei0r: Protect set/get property and processing functions from concurrent access
The frei0r documentation says that these functions must not be called on the same instance from different threads at the same time. All other functions are guaranteed to be threadsafe.
Diffstat (limited to 'gst/frei0r')
-rw-r--r--gst/frei0r/gstfrei0rfilter.c8
-rw-r--r--gst/frei0r/gstfrei0rmixer.c6
-rw-r--r--gst/frei0r/gstfrei0rsrc.c6
3 files changed, 19 insertions, 1 deletions
diff --git a/gst/frei0r/gstfrei0rfilter.c b/gst/frei0r/gstfrei0rfilter.c
index eda78adf8..fc60a9034 100644
--- a/gst/frei0r/gstfrei0rfilter.c
+++ b/gst/frei0r/gstfrei0rfilter.c
@@ -1,5 +1,5 @@
/* GStreamer
- * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * Copyright (C) 2009,2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -85,6 +85,7 @@ gst_frei0r_filter_transform (GstBaseTransform * trans, GstBuffer * inbuf,
time = ((gdouble) GST_BUFFER_TIMESTAMP (inbuf)) / GST_SECOND;
+ GST_OBJECT_LOCK (self);
if (klass->ftable->update2)
klass->ftable->update2 (self->f0r_instance, time,
(const guint32 *) GST_BUFFER_DATA (inbuf), NULL, NULL,
@@ -93,6 +94,7 @@ gst_frei0r_filter_transform (GstBaseTransform * trans, GstBuffer * inbuf,
klass->ftable->update (self->f0r_instance, time,
(const guint32 *) GST_BUFFER_DATA (inbuf),
(guint32 *) GST_BUFFER_DATA (outbuf));
+ GST_OBJECT_UNLOCK (self);
return GST_FLOW_OK;
}
@@ -123,10 +125,12 @@ gst_frei0r_filter_get_property (GObject * object, guint prop_id, GValue * value,
GstFrei0rFilter *self = GST_FREI0R_FILTER (object);
GstFrei0rFilterClass *klass = GST_FREI0R_FILTER_GET_CLASS (object);
+ GST_OBJECT_LOCK (self);
if (!gst_frei0r_get_property (self->f0r_instance, klass->ftable,
klass->properties, klass->n_properties, self->property_cache, prop_id,
value))
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ GST_OBJECT_UNLOCK (self);
}
static void
@@ -136,10 +140,12 @@ gst_frei0r_filter_set_property (GObject * object, guint prop_id,
GstFrei0rFilter *self = GST_FREI0R_FILTER (object);
GstFrei0rFilterClass *klass = GST_FREI0R_FILTER_GET_CLASS (object);
+ GST_OBJECT_LOCK (self);
if (!gst_frei0r_set_property (self->f0r_instance, klass->ftable,
klass->properties, klass->n_properties, self->property_cache, prop_id,
value))
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ GST_OBJECT_UNLOCK (self);
}
static void
diff --git a/gst/frei0r/gstfrei0rmixer.c b/gst/frei0r/gstfrei0rmixer.c
index cd315e185..486e96e45 100644
--- a/gst/frei0r/gstfrei0rmixer.c
+++ b/gst/frei0r/gstfrei0rmixer.c
@@ -84,10 +84,12 @@ gst_frei0r_mixer_get_property (GObject * object, guint prop_id, GValue * value,
GstFrei0rMixer *self = GST_FREI0R_MIXER (object);
GstFrei0rMixerClass *klass = GST_FREI0R_MIXER_GET_CLASS (object);
+ GST_OBJECT_LOCK (self);
if (!gst_frei0r_get_property (self->f0r_instance, klass->ftable,
klass->properties, klass->n_properties, self->property_cache, prop_id,
value))
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ GST_OBJECT_UNLOCK (self);
}
static void
@@ -97,10 +99,12 @@ gst_frei0r_mixer_set_property (GObject * object, guint prop_id,
GstFrei0rMixer *self = GST_FREI0R_MIXER (object);
GstFrei0rMixerClass *klass = GST_FREI0R_MIXER_GET_CLASS (object);
+ GST_OBJECT_LOCK (self);
if (!gst_frei0r_set_property (self->f0r_instance, klass->ftable,
klass->properties, klass->n_properties, self->property_cache, prop_id,
value))
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ GST_OBJECT_UNLOCK (self);
}
static GstStateChangeReturn
@@ -584,11 +588,13 @@ gst_frei0r_mixer_collected (GstCollectPads * pads, GstFrei0rMixer * self)
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS);
time = ((gdouble) GST_BUFFER_TIMESTAMP (outbuf)) / GST_SECOND;
+ GST_OBJECT_LOCK (self);
klass->ftable->update2 (self->f0r_instance, time,
(const guint32 *) GST_BUFFER_DATA (inbuf0),
(const guint32 *) GST_BUFFER_DATA (inbuf1),
(inbuf2) ? (const guint32 *) GST_BUFFER_DATA (inbuf2) : NULL,
(guint32 *) GST_BUFFER_DATA (outbuf));
+ GST_OBJECT_UNLOCK (self);
gst_buffer_unref (inbuf0);
gst_buffer_unref (inbuf1);
diff --git a/gst/frei0r/gstfrei0rsrc.c b/gst/frei0r/gstfrei0rsrc.c
index 2d637f95b..69b905b0f 100644
--- a/gst/frei0r/gstfrei0rsrc.c
+++ b/gst/frei0r/gstfrei0rsrc.c
@@ -113,12 +113,14 @@ gst_frei0r_src_create (GstPushSrc * src, GstBuffer ** buf)
time = ((gdouble) GST_BUFFER_TIMESTAMP (outbuf)) / GST_SECOND;
+ GST_OBJECT_LOCK (self);
if (klass->ftable->update2)
klass->ftable->update2 (self->f0r_instance, time, NULL, NULL, NULL,
(guint32 *) GST_BUFFER_DATA (outbuf));
else
klass->ftable->update (self->f0r_instance, time, NULL,
(guint32 *) GST_BUFFER_DATA (outbuf));
+ GST_OBJECT_UNLOCK (self);
*buf = outbuf;
@@ -291,10 +293,12 @@ gst_frei0r_src_get_property (GObject * object, guint prop_id, GValue * value,
GstFrei0rSrc *self = GST_FREI0R_SRC (object);
GstFrei0rSrcClass *klass = GST_FREI0R_SRC_GET_CLASS (object);
+ GST_OBJECT_LOCK (self);
if (!gst_frei0r_get_property (self->f0r_instance, klass->ftable,
klass->properties, klass->n_properties, self->property_cache, prop_id,
value))
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ GST_OBJECT_UNLOCK (self);
}
static void
@@ -304,10 +308,12 @@ gst_frei0r_src_set_property (GObject * object, guint prop_id,
GstFrei0rSrc *self = GST_FREI0R_SRC (object);
GstFrei0rSrcClass *klass = GST_FREI0R_SRC_GET_CLASS (object);
+ GST_OBJECT_LOCK (self);
if (!gst_frei0r_set_property (self->f0r_instance, klass->ftable,
klass->properties, klass->n_properties, self->property_cache, prop_id,
value))
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ GST_OBJECT_UNLOCK (self);
}
static void