libgstapp ownership

Chris Tapp opensource at keylevel.com
Mon Oct 20 15:25:53 PDT 2014


On 20 Oct 2014, at 22:06, Sebastian Dröge <sebastian at centricular.com> wrote:

> On Mo, 2014-10-20 at 21:51 +0100, Chris Tapp wrote:
>> 
>>>> This is correct in this particular context.
>> 
>> Except this is causing a memory leak where as the above doesn't. Does it make a difference that the samples are taken using "last-sample" from one pipeline and the appsrc is in another?
> 
> 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.

--

Chris Tapp
opensource at keylevel.com
www.keylevel.com

----
You can tell you're getting older when your car insurance gets real cheap!



More information about the gstreamer-devel mailing list