mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-07 12:21:17 +00:00
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:
parent
40228b4aa5
commit
af42e44af5
1 changed files with 13 additions and 0 deletions
13
gst/gstpad.c
13
gst/gstpad.c
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue