libgstapp ownership

Tim Müller tim at centricular.com
Tue Oct 21 08:29:05 PDT 2014


On Mon, 2014-10-20 at 23:25 +0100, Chris Tapp wrote:

> > You have to unref the sample after usage as the last-sample property
> > will give you a new reference. If you unref the buffer as in your first
> > example, the buffer will be freed but the sample will still be leaked.
> 
> Sure, and I am doing that just after I pass the gst_sample_ref() of it's buffer to push_buffer(). So what I have is:
> 
>    aSample = get last-sample from sink
> 
>    GstBuffer * buffer = gst_sample_get_buffer( aSample );
> 
>    gst_app_src_push_buffer( myAppSrc, gst_sample_ref( buffer ) );
> 
>    gst_sample_unref( aSample );
> 
> But this leaks memory if I don't remove the gst_sample_ref() call.

Could you make a small stand-alone test case that demonstrates this
issue?

Does the leak go away if you remove the

   gst_app_src_push_buffer(myAppSrc, gst_sample_ref(buffer)); 

line?

It could be that the buffer is leaked somewhere downstream of appsrc, or
appsrc doesn't properly clean up pending buffers somewhere in some
cases.

 Cheers
  -Tim
-- 
Tim Müller, Centricular Ltd - http://www.centricular.com



More information about the gstreamer-devel mailing list