libgstapp ownership

Chris Tapp opensource at keylevel.com
Tue Oct 21 13:04:44 PDT 2014


On 21 Oct 2014, at 16:29, Tim Müller <tim at centricular.com> wrote:

> 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?

I'll give it a go ;-)

> Does the leak go away if you remove the
> 
>   gst_app_src_push_buffer(myAppSrc, gst_sample_ref(buffer)); 
> 
> line?

Yes.

> 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.

The pipeline is quite simple:

   appsrc ! videoscale ! videoconvert ! caps ! appsink

This is used to scale/convert frames on demand.

--

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