GstCollectPads: getting callbacks when a sinkpad's buffer has size 0.

Sebastian Dröge sebastian at centricular.com
Wed Apr 2 12:01:14 PDT 2014


On Di, 2014-04-01 at 10:52 -0400, Lei Miao wrote:
> Hi all,
> 
> I had a strange problem with GstCollectPads in both gst 0.10 and gst 1.0.
> Basically, we have an element that has a collect pad with two sinks. The
> beginning of the pipeline is as follows:
> 
> souphttpsrc1->queue->sink1 of the collect pad
> 
> 
> souphttpsrc2->queue->sink2 of the collect pad
> 
> In this element, we use gst_collect_pads_set_function() to specify the
> callback function. The code has been working well most of the time.
> However, I sometimes notice that sink1 of the collect pad has a buffer of
> length 0 when the call back function is called. This is really strange. The
> reference manual says: "...this sets a callback that will be invoked
> instead when all the pads added to the collection have buffers queued." My
> understanding is that the callback function should only be called when both
> sink pads have buffers queued. But in reality, we are getting callbacks
> when one of the sink pads has zero length buffer.
> 
> To be specific, in the callback function, we first
> use gst_pad_get_element_private() to get the private data of the sink pad.
> We then get the buffer:
> GstBuffer * buf = gst_collect_pads_read_buffer(data->collect, data, 1024);
> GstMapInfo info;
> gst_buffer_map (buf, &info, GST_MAP_READ);
> int size = info.size;
> 
> "size" sometimes is zero.
> 
> Does anybody know why the callback function is called in this case?

A zero-sized buffer is a valid buffer, so collectpads considering that
as such seems correct. However it seems wrong that you have zero-sized
buffers in your pipeline. I would start debugging which element inserts
them and why, and then make sure that this doesn't happen.

-- 
Sebastian Dröge, Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140402/e60f2a63/attachment.sig>


More information about the gstreamer-devel mailing list