Need to unref context after setting it in GstVideoOverlay ?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Need to unref context after setting it in GstVideoOverlay ?

Guillermo Rodriguez Garcia-2
Hi all,

I am using gstwaylandsink with an external wayland surface.
In the bus sync handler I need to set the Wayland display context as
well as the surface handle. For the context I am doing the following:

    GstContext *context =
gst_context_new(GST_WAYLAND_DISPLAY_HANDLE_CONTEXT_TYPE, TRUE);
    gst_structure_set(gst_context_writable_structure(context),
"handle", G_TYPE_POINTER, wayland_display, NULL);
    gst_element_set_context(pipeline, context);

Do I need to unref the context after gst_element_set_context ? Or will
it be automatically freed once the pipeline is released?

Thanks,

Guillermo Rodriguez Garcia
[hidden email]
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Need to unref context after setting it in GstVideoOverlay ?

Guillaume Desmottes-2
Hi Guillermo,

The context argument of gst_element_set_context() is marked as
"(transfer none)" in the documentation.
This means the caller preserves ownership of it and so should unref it
with gst_context_unref() once it's done with it.


     G.

On 22/01/2020 15:33, Guillermo Rodriguez Garcia wrote:

> Hi all,
>
> I am using gstwaylandsink with an external wayland surface.
> In the bus sync handler I need to set the Wayland display context as
> well as the surface handle. For the context I am doing the following:
>
>      GstContext *context =
> gst_context_new(GST_WAYLAND_DISPLAY_HANDLE_CONTEXT_TYPE, TRUE);
>      gst_structure_set(gst_context_writable_structure(context),
> "handle", G_TYPE_POINTER, wayland_display, NULL);
>      gst_element_set_context(pipeline, context);
>
> Do I need to unref the context after gst_element_set_context ? Or will
> it be automatically freed once the pipeline is released?
>
> Thanks,
>
> Guillermo Rodriguez Garcia
> [hidden email]
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Need to unref context after setting it in GstVideoOverlay ?

Guillermo Rodriguez Garcia-2
Hi Guillaume,

Thank you for the clarification, this was my understanding too, but I was
confused because none of the examples I have found around (including
examples in the Gstreamer source tree itself) actually do this...

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/blob/master/tests/examples/waylandsink/main.c
https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/blob/master/tests/examples/waylandsink/wayland-threads.c

BR,

Guillermo

El mié., 22 ene. 2020 a las 11:08, Guillaume Desmottes
(<[hidden email]>) escribió:

>
> Hi Guillermo,
>
> The context argument of gst_element_set_context() is marked as
> "(transfer none)" in the documentation.
> This means the caller preserves ownership of it and so should unref it
> with gst_context_unref() once it's done with it.
>
>
>      G.
>
> On 22/01/2020 15:33, Guillermo Rodriguez Garcia wrote:
> > Hi all,
> >
> > I am using gstwaylandsink with an external wayland surface.
> > In the bus sync handler I need to set the Wayland display context as
> > well as the surface handle. For the context I am doing the following:
> >
> >      GstContext *context =
> > gst_context_new(GST_WAYLAND_DISPLAY_HANDLE_CONTEXT_TYPE, TRUE);
> >      gst_structure_set(gst_context_writable_structure(context),
> > "handle", G_TYPE_POINTER, wayland_display, NULL);
> >      gst_element_set_context(pipeline, context);
> >
> > Do I need to unref the context after gst_element_set_context ? Or will
> > it be automatically freed once the pipeline is released?
> >
> > Thanks,
> >
> > Guillermo Rodriguez Garcia
> > [hidden email]
> > _______________________________________________
> > gstreamer-devel mailing list
> > [hidden email]
> > https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



--
Guillermo Rodriguez Garcia
[hidden email]
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Need to unref context after setting it in GstVideoOverlay ?

Guillaume Desmottes-2
Indeed, looks like a leak in those examples.

Can you please open a bug about it, or even a pull request fixing it? :)

     G.

On 22/01/2020 15:56, Guillermo Rodriguez Garcia wrote:

> Hi Guillaume,
>
> Thank you for the clarification, this was my understanding too, but I was
> confused because none of the examples I have found around (including
> examples in the Gstreamer source tree itself) actually do this...
>
> https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/blob/master/tests/examples/waylandsink/main.c
> https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/blob/master/tests/examples/waylandsink/wayland-threads.c
>
> BR,
>
> Guillermo
>
> El mié., 22 ene. 2020 a las 11:08, Guillaume Desmottes
> (<[hidden email]>) escribió:
>> Hi Guillermo,
>>
>> The context argument of gst_element_set_context() is marked as
>> "(transfer none)" in the documentation.
>> This means the caller preserves ownership of it and so should unref it
>> with gst_context_unref() once it's done with it.
>>
>>
>>       G.
>>
>> On 22/01/2020 15:33, Guillermo Rodriguez Garcia wrote:
>>> Hi all,
>>>
>>> I am using gstwaylandsink with an external wayland surface.
>>> In the bus sync handler I need to set the Wayland display context as
>>> well as the surface handle. For the context I am doing the following:
>>>
>>>       GstContext *context =
>>> gst_context_new(GST_WAYLAND_DISPLAY_HANDLE_CONTEXT_TYPE, TRUE);
>>>       gst_structure_set(gst_context_writable_structure(context),
>>> "handle", G_TYPE_POINTER, wayland_display, NULL);
>>>       gst_element_set_context(pipeline, context);
>>>
>>> Do I need to unref the context after gst_element_set_context ? Or will
>>> it be automatically freed once the pipeline is released?
>>>
>>> Thanks,
>>>
>>> Guillermo Rodriguez Garcia
>>> [hidden email]
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> [hidden email]
>>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Need to unref context after setting it in GstVideoOverlay ?

Guillermo Rodriguez Garcia-2
Just did that (https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/996).
First time I used Gitlab, hope didn't do anything strange.

Thanks,

Guillermo

El mié., 22 ene. 2020 a las 11:36, Guillaume Desmottes
(<[hidden email]>) escribió:

>
> Indeed, looks like a leak in those examples.
>
> Can you please open a bug about it, or even a pull request fixing it? :)
>
>      G.
>
> On 22/01/2020 15:56, Guillermo Rodriguez Garcia wrote:
> > Hi Guillaume,
> >
> > Thank you for the clarification, this was my understanding too, but I was
> > confused because none of the examples I have found around (including
> > examples in the Gstreamer source tree itself) actually do this...
> >
> > https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/blob/master/tests/examples/waylandsink/main.c
> > https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/blob/master/tests/examples/waylandsink/wayland-threads.c
> >
> > BR,
> >
> > Guillermo
> >
> > El mié., 22 ene. 2020 a las 11:08, Guillaume Desmottes
> > (<[hidden email]>) escribió:
> >> Hi Guillermo,
> >>
> >> The context argument of gst_element_set_context() is marked as
> >> "(transfer none)" in the documentation.
> >> This means the caller preserves ownership of it and so should unref it
> >> with gst_context_unref() once it's done with it.
> >>
> >>
> >>       G.
> >>
> >> On 22/01/2020 15:33, Guillermo Rodriguez Garcia wrote:
> >>> Hi all,
> >>>
> >>> I am using gstwaylandsink with an external wayland surface.
> >>> In the bus sync handler I need to set the Wayland display context as
> >>> well as the surface handle. For the context I am doing the following:
> >>>
> >>>       GstContext *context =
> >>> gst_context_new(GST_WAYLAND_DISPLAY_HANDLE_CONTEXT_TYPE, TRUE);
> >>>       gst_structure_set(gst_context_writable_structure(context),
> >>> "handle", G_TYPE_POINTER, wayland_display, NULL);
> >>>       gst_element_set_context(pipeline, context);
> >>>
> >>> Do I need to unref the context after gst_element_set_context ? Or will
> >>> it be automatically freed once the pipeline is released?
> >>>
> >>> Thanks,
> >>>
> >>> Guillermo Rodriguez Garcia
> >>> [hidden email]
> >>> _______________________________________________
> >>> gstreamer-devel mailing list
> >>> [hidden email]
> >>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >> _______________________________________________
> >> gstreamer-devel mailing list
> >> [hidden email]
> >> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
> >
> >
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



--
Guillermo Rodriguez Garcia
[hidden email]
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel