Using "convert-sample" from playbin
Sebastian Dröge
sebastian at centricular.com
Sun Aug 3 23:15:11 PDT 2014
On So, 2014-08-03 at 20:12 +0100, Chris Tapp wrote:
> On 3 Aug 2014, at 08:37, Sebastian Dröge <sebastian at centricular.com> wrote:
>
> > On So, 2014-08-03 at 01:45 +0100, Chris Tapp wrote:
> >> I want to be able to grab a converted copy of the most recent frame from a video pipeline.
> >>
> >> The pipeline is created using gst_parse_launch() and contains a "playbin" element.
> >
> > You can also just use pipeline = gst_element_factory_make("playbin", NULL);
> >
> >> I then use the following to grab and process the converted frames:
> >>
> >> g_signal_emit_by_name( pipeline, "convert-sample", target_caps, &frame );
> >>
> >> // Process frame...
> >>
> >> gst_sample_unref( frame );
> >>
> >> However, this causes a memory leak. What am I doing wrong?
> >
> > Impossible to say without more code. Can you provide a testcase that
> > reproduces it?
>
> I've actually reduced the code to just a little bit more than above and still see the problem:
>
> GstCaps * caps;
>
> caps = gst_caps_new_simple( ... );
>
> g_signal_emit_by_name( pipeline, "convert-sample", target_caps, &frame );
>
> // Process frame...
>
> gst_sample_unref( frame );
>
> gst_caps_unref( caps );
>
> After a bit of digging I noticed that GST_OBJECT_REFCOUNT_VALUE( frame ) reports a ref count of 2, but I would have expected a value of 1.
>
> Adding a second gst_sample_unref( frame ) call fixes the problem.
That's not a fix though :)
What are you doing between g_signal_emit_by_name() and
gst_sample_unref()? Are you leaking a reference of anything from the
sample there?
--
Sebastian Dröge, Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140804/a513d06e/attachment-0001.sig>
More information about the gstreamer-devel
mailing list