[gst-devel] gst_buffer_unref and pad push

Tim-Philipp Müller t.i.m at zen.co.uk
Fri Jun 5 13:19:56 CEST 2009


On Fri, 2009-06-05 at 16:12 +0530, Arnab Samanta wrote:

>  When a plugin does the gst_pad_push() of a buffer, the next plugin in
> the pipeline does the gst_buffer_unref() of that buffer in its
> chain().

Correct. You give away your ownership/ref of the buffer with
_pad_push().


>  What if gst_pad_push() fails .... in that case is the plugin sending
> the buffer has to unreference the buffer

No. You gave away ownership of the buffer.


>  My understanding is it should be done by the plugin doing the
> pad_push() as it can be seen in many plugin codes.

No, that would be a bug. If you see any gstreamer plugin unrefing the
buffer it pushed depending on the flow return from gst_pad_push(),
please file a bug or tell us otherwise.

When you look for example code, you should primarily look at
core/gst-plugins-base/gst-plugins-good, not -bad (fwiw).


>  But when I am doing as its mentioned above,
>  I am getting the Gstreamer Warning: 
> 
> (<unknown>:1295): GStreamer-CRITICAL **:
> 
> gst_mini_object_unref: assertion `mini_object->refcount > 0' failed
> which means , the reference count of the buffer is already 0. 

That's because you shouldn't be unrefing that most likely.

Cheers
 -Tim






More information about the gstreamer-devel mailing list