gst/gstpad.c: A flushing pad cannot be used to alloc_buffer from.

Original commit message from CVS:
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_prepare),
(gst_pad_link), (gst_pad_accept_caps), (gst_pad_alloc_buffer),
(gst_pad_query), (gst_pad_send_event), (gst_pad_start_task):
A flushing pad cannot be used to alloc_buffer from.
This commit is contained in:
Wim Taymans 2005-05-26 10:50:12 +00:00
parent ea2dd0057c
commit 61167c9097
2 changed files with 24 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2005-05-26 Wim Taymans <wim@fluendo.com>
* gst/gstpad.c: (gst_pad_set_active), (gst_pad_link_prepare),
(gst_pad_link), (gst_pad_accept_caps), (gst_pad_alloc_buffer),
(gst_pad_query), (gst_pad_send_event), (gst_pad_start_task):
A flushing pad cannot be used to alloc_buffer from.
2005-05-26 Wim Taymans <wim@fluendo.com>
* gst/gstbus.c: (gst_bus_init), (gst_bus_dispose), (gst_bus_post),

View file

@ -2244,18 +2244,23 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps)
if (G_UNLIKELY ((peer = GST_RPAD_PEER (pad)) == NULL))
goto no_peer;
gst_object_ref (GST_OBJECT_CAST (peer));
GST_UNLOCK (pad);
if (G_LIKELY ((bufferallocfunc = peer->bufferallocfunc) == NULL)) {
GST_UNLOCK (pad);
goto fallback;
}
gst_object_ref (GST_OBJECT_CAST (peer));
GST_UNLOCK (pad);
GST_LOCK (peer);
/* when the peer is flushing we cannot give a buffer */
if (G_UNLIKELY (GST_RPAD_IS_FLUSHING (peer)))
goto flushing;
GST_CAT_DEBUG (GST_CAT_PADS,
"calling bufferallocfunc &%s (@%p) of peer pad %s:%s",
GST_DEBUG_FUNCPTR_NAME (bufferallocfunc),
&bufferallocfunc, GST_DEBUG_PAD_NAME (peer));
GST_UNLOCK (peer);
result = bufferallocfunc (GST_PAD_CAST (peer), offset, size, caps);
@ -2287,6 +2292,15 @@ no_peer:
GST_UNLOCK (pad);
return NULL;
}
flushing:
{
/* pad has no peer */
GST_UNLOCK (peer);
GST_CAT_DEBUG (GST_CAT_PADS,
"%s:%s called bufferallocfunc but peer was flushing, returning NULL",
GST_DEBUG_PAD_NAME (pad));
return NULL;
}
/* fallback case, allocate a buffer of our own, add pad caps. */
fallback:
{