pad: keep counter for active pads

Keep a counter to mark the amount of threads currently pushing data on the pad.
This commit is contained in:
Wim Taymans 2011-05-26 17:50:15 +02:00
parent 40228b4aa5
commit af42e44af5

View file

@ -110,6 +110,8 @@ typedef struct
struct _GstPadPrivate
{
PadEvent events[GST_EVENT_MAX_STICKY];
gint using;
};
static void gst_pad_dispose (GObject * object);
@ -3932,6 +3934,7 @@ again:
/* take ref to peer pad before releasing the lock */
gst_object_ref (*peer);
pad->priv->using++;
GST_OBJECT_UNLOCK (pad);
return GST_FLOW_OK;
@ -3957,6 +3960,14 @@ not_linked:
}
}
static void
pad_post_push (GstPad * pad)
{
GST_OBJECT_LOCK (pad);
pad->priv->using--;
GST_OBJECT_UNLOCK (pad);
}
static GstFlowReturn
gst_pad_push_data (GstPad * pad, gboolean is_buffer, void *data)
{
@ -3970,6 +3981,8 @@ gst_pad_push_data (GstPad * pad, gboolean is_buffer, void *data)
gst_object_unref (peer);
pad_post_push (pad);
return ret;
/* ERROR recovery here */