Remove Context from Elements

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

Remove Context from Elements

Matthew Walker
Hi all,

I am working on an application which creates and utilises gstreamer pipelines. One of the requirements is that the application must be able to erase the STC context from the pipeline when stopping playback.

Currently I am using a function which resets the STC context on a given element in conjunction with gst_iterator_foreach but I was wondering if there was a better way to do this. Is there a gstreamer function which can remove the STC context type from the context list of every element in a pipeline?

Thanks for your help,
Matthew

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

Re: Remove Context from Elements

Nicolas Dufresne-5
Le mardi 06 avril 2021 à 08:43 +0100, Matthew Walker a écrit :

> Hi all,
>
> I am working on an application which creates and utilises gstreamer pipelines.
> One of the requirements is that the application must be able to erase the STC
> context from the pipeline when stopping playback.
>
> Currently I am using a function which resets the STC context on a given
> element in conjunction with gst_iterator_foreach but I was wondering if there
> was a better way to do this. Is there a gstreamer function which can remove
> the STC context type from the context list of every element in a pipeline?

All GstContext stored should be release when setting the pipeline to NULL state.
If not, this is a bug.

>
> Thanks for your help,
> Matthew
> _______________________________________________
> 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: Remove Context from Elements

Tom Bailey
Hi Nicolas,

I've been working with Matthew on this project so I can expand a bit on the problem he's facing. We are using a custom GstContext with our pipeline, which is allocated and set by the application in response to the GST_MESSAGE_NEED_CONTEXT. At some point this context can be marked as invalid, which can be achieved with the existing API by setting a new context with some fields in the underlying GstStructure set to null. We would then like the elements in the pipeline to request a new context from the application by sending another GST_MESSAGE_NEED_CONTEXT, but this message is intercepted by GstBin, which simply sets the original context (https://github.com/GStreamer/gstreamer/blob/master/gst/gstbin.c#L3996).

It's not possible to pass a null pointer to gst_element_set_context() to "null out" an existing context, which would force GstBin to request a new one from the application.

It looks like we would need a new API, gst_element_remove_context(), in order to achieve what we want, unless we have missed something?

Best regards

Tom


From: gstreamer-devel <[hidden email]> on behalf of Nicolas Dufresne <[hidden email]>
Sent: 06 April 2021 14:57
To: Discussion of the development of and with GStreamer <[hidden email]>
Subject: Re: Remove Context from Elements
 
[External email]


Le mardi 06 avril 2021 à 08:43 +0100, Matthew Walker a écrit :
> Hi all,
>
> I am working on an application which creates and utilises gstreamer pipelines.
> One of the requirements is that the application must be able to erase the STC
> context from the pipeline when stopping playback.
>
> Currently I am using a function which resets the STC context on a given
> element in conjunction with gst_iterator_foreach but I was wondering if there
> was a better way to do this. Is there a gstreamer function which can remove
> the STC context type from the context list of every element in a pipeline?

All GstContext stored should be release when setting the pipeline to NULL state.
If not, this is a bug.

>
> Thanks for your help,
> Matthew
> _______________________________________________
> 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


[External email. Treat hyperlinks and attachments with caution]

This transmission contains information that may be confidential and contain personal views which are not necessarily those of YouView TV Ltd. YouView TV Ltd (Co No:7308805) is a limited liability company registered in England and Wales with its registered address at YouView TV Ltd, 3rd Floor, 10 Lower Thames Street, London, EC3R 6YT. For details see our web site at http://www.youview.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Remove Context from Elements

Nicolas Dufresne-5
Le mardi 06 avril 2021 à 17:45 +0000, Tom Bailey a écrit :
> Hi Nicolas,
>
> I've been working with Matthew on this project so I can expand a bit on the
> problem he's facing. We are using a custom GstContext with our pipeline, which
> is allocated and set by the application in response to
> the GST_MESSAGE_NEED_CONTEXT. At some point this context can be marked as
> invalid, which can be achieved with the existing API by setting a new context
> with some fields in the underlying GstStructure set to null. We would then

This might be non-thread-safe, I'm just warning.

> like the elements in the pipeline to request a new context from the
> application by sending another GST_MESSAGE_NEED_CONTEXT, but this message is
> intercepted by GstBin, which simply sets the original context (
> https://github.com/GStreamer/gstreamer/blob/master/gst/gstbin.c#L3996).
>
> It's not possible to pass a null pointer to gst_element_set_context() to "null
> out" an existing context, which would force GstBin to request a new one from
> the application.
>
> It looks like we would need a new API, gst_element_remove_context(), in order
> to achieve what we want, unless we have missed something?

At the moment, the designed solution to reset your context is to reset your
pipeline. This require cycling it to NULL state. That of course only work if
your context is not persistent.

 * #GstContext can be persistent.
 * A persistent #GstContext is kept in elements when they reach
 * %GST_STATE_NULL, non-persistent ones will be removed.
 * Also, a non-persistent context won't override a previous persistent
 * context set to an element.

That being said, if the application is aware, why does it need to wait for
NEED_CONTEXT to set the context again ?

>
> Best regards
>
> Tom
>
> gstreamer/gstbin.c at master · GStreamer/gstreamer · GitHub
> GStreamer open-source multimedia framework core library - GStreamer/gstreamer
> github.com
>
> From: gstreamer-devel <[hidden email]> on behalf
> of Nicolas Dufresne <[hidden email]>
> Sent: 06 April 2021 14:57
> To: Discussion of the development of and with GStreamer <
> [hidden email]>
> Subject: Re: Remove Context from Elements 
> [External email]
>
>
> Le mardi 06 avril 2021 à 08:43 +0100, Matthew Walker a écrit :
> > Hi all,
> >
> > I am working on an application which creates and utilises gstreamer pipelines.
> > One of the requirements is that the application must be able to erase the STC
> > context from the pipeline when stopping playback.
> >
> > Currently I am using a function which resets the STC context on a given
> > element in conjunction with gst_iterator_foreach but I was wondering if there
> > was a better way to do this. Is there a gstreamer function which can remove
> > the STC context type from the context list of every element in a pipeline?
>
> All GstContext stored should be release when setting the pipeline to NULL state.
> If not, this is a bug.
>
> >
> > Thanks for your help,
> > Matthew
> > _______________________________________________
> > 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
>
>
> [External email. Treat hyperlinks and attachments with caution]
>
> This transmission contains information that may be confidential and contain
> personal views which are not necessarily those of YouView TV Ltd. YouView TV Ltd
> (Co No:7308805) is a limited liability company registered in England and Wales
> with its registered address at YouView TV Ltd, 3rd Floor, 10 Lower Thames
> Street, London, EC3R 6YT. For details see our web site at
> http://www.youview.com
> _______________________________________________
> 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