[gst-devel] gst_buffer_new_and_alloc: unreferencing

Edward Hervey bilboed at gmail.com
Fri Jul 27 10:42:35 CEST 2007


Hi,

  Buffers are reference-counted. They will be freed when the last reference
to it is dropped.

  When you create a buffer using gst_buffer_new_and_alloc(), it will return
a buffer with a count of 1. When you use gst_pad_push(), that function will
TAKE that reference (have a close look at the API documentation) which means
that you can no longer use that buffer in your code unless you add a
reference.
  If that element is just before the audiosink, then once the audiosink has
finished with it (when it copied the contents to the ringbuffer), it will
unref it by one, which will make the count drop to 0 which means it will be
freed.
  If you have a non-inplace transformation element in between (audioresample
for ex), that element will create a new buffer and put the processed data
into it, and the refcount to your buffer will drop when that element is done
with it.

   Edward

On 7/27/07, pritesh <digitaldsp at excite.com> wrote:
>
>
>
> hi all,
>
> i want to know about gst_buffer_new_and_alloc api
>
> if a buffer is created by this api , and pushed to downstream element(say
> audiosink) , where its memory is freed.
> whether it will be freed in audiosink(say osssink).
>
> ------------------------------
> *Join Excite! - http://www.excite.com*
> The most personalized portal on the Web!
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>


-- 
Edward Hervey
Multimedia editing developer
http://www.pitivi.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20070727/68dc9be3/attachment.htm>


More information about the gstreamer-devel mailing list