How to do lengthy processing in an element

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

How to do lengthy processing in an element

filnet
Hi,

I have an element that needs, at some point in time after analyzing a number of frames, to do a lengthy processing. Currently it is done in the chain() method, stalling the pipeline, but could be done asynchronously.

Does gstreamer have facilities for launching some task in a separate thread and make the result available to the element once done, all this without having to muck with threads, locks, etc... ?

Cheers,
Philippe.


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

Re: How to do lengthy processing in an element

filnet
Answering my own question : gst_element_async_call() seems to fit the bill.


Le Vendredi 2 décembre 2016 17h30, philippe renon <[hidden email]> a écrit :


Hi,

I have an element that needs, at some point in time after analyzing a number of frames, to do a lengthy processing. Currently it is done in the chain() method, stalling the pipeline, but could be done asynchronously.

Does gstreamer have facilities for launching some task in a separate thread and make the result available to the element once done, all this without having to muck with threads, locks, etc... ?

Cheers,
Philippe.




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

Re: How to do lengthy processing in an element

Sebastian Dröge-3
On Fri, 2016-12-09 at 09:50 +0000, philippe renon wrote:
> Answering my own question : gst_element_async_call() seems to fit the
> bill.

That's more for one-shot, simple tasks that don't take are not
continuously running. Like if you have to do some action on your
element from a non-streaming thread.

For long-running tasks that are just the element processing, you should
consider starting a new thread.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to do lengthy processing in an element

filnet
It is a one shot task that I need to execute.

The element analyzes video frames and once it has accumulated enough samples it needs to do a one shot computation that can take several seconds to complete.
The result of the computation needs to be fed back into the element.



Le Vendredi 9 décembre 2016 10h57, Sebastian Dröge <[hidden email]> a écrit :


On Fri, 2016-12-09 at 09:50 +0000, philippe renon wrote:

> Answering my own question : gst_element_async_call() seems to fit the
> bill.


That's more for one-shot, simple tasks that don't take are not
continuously running. Like if you have to do some action on your
element from a non-streaming thread.

For long-running tasks that are just the element processing, you should
consider starting a new thread.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com


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

Re: How to do lengthy processing in an element

Sebastian Dröge-3
On Fri, 2016-12-09 at 10:05 +0000, philippe renon wrote:
> It is a one shot task that I need to execute.
>
> The element analyzes video frames and once it has accumulated enough
> samples it needs to do a one shot computation that can take several
> seconds to complete.
> The result of the computation needs to be fed back into the element.

Does the element have to wait until that computation is finished before
it can do anything else?

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to do lengthy processing in an element

filnet

> Does the element have to wait until that computation is finished before
> it can do anything else?
No, it does not.

Le Vendredi 9 décembre 2016 11h09, Sebastian Dröge <[hidden email]> a écrit :


On Fri, 2016-12-09 at 10:05 +0000, philippe renon wrote:
> It is a one shot task that I need to execute.
>
> The element analyzes video frames and once it has accumulated enough
> samples it needs to do a one shot computation that can take several
> seconds to complete.
> The result of the computation needs to be fed back into the element.

Does the element have to wait until that computation is finished before
it can do anything else?


--
Sebastian Dröge, Centricular Ltd · http://www.centricular.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
Reply | Threaded
Open this post in threaded view
|

Re: How to do lengthy processing in an element

Sebastian Dröge-3
On Fri, 2016-12-09 at 10:11 +0000, philippe renon wrote:
>
> > Does the element have to wait until that computation is finished
> before
> > it can do anything else?
> No, it does not.

Then this sounds like the right API :)

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (981 bytes) Download Attachment