Problem with GstQueryAllocation pool refcount

Nicolas Dufresne nicolas at
Wed Dec 7 15:52:12 UTC 2022

Le mercredi 07 décembre 2022 à 06:29 +0000, Edgar Thier a écrit :
> > This is because the method to store a pool in the query is not a
> > "transfer:floating" method. From the doc, you can see "transfer: none"
> > annotation.
> Please excuse my confusion:
> I was under the impression that "transfer: none: either means that
> - the refcount will not be increased and the query will only hold a pointer
> - the query will increase the refcount so as to not have a potentially invalid
> pointer
>   but also unref as soon as it does not need the pool anymore
> Whereas "transfer: full" implies that I as the caller should not touch the
> transferred object
> from here on as everything is handled by the called.
> It seems that I am having wrong expectations concerning the behavior of
> "transfer: none".
> If anyone could help me clear up that misinterpretation that would be much
> appreciated!

When calling a function, so passing an object as argument, transfer: none, means
the caller will keep its ownership, while transfer: full means the caller will
give away its ownership. If you keep your ownsership and don't want to keep the
object around, you need to unref such object. This is your case.

This is slightly different for return values, were transfer: none means no new
reference is given, while transfer: full (or floating) means a reference /
complete ownership is given.

> Thank you,
> Edgar

More information about the gstreamer-devel mailing list