GStreamer workers to speed up a GstElement

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

GStreamer workers to speed up a GstElement

GStreamer-devel mailing list
I'm trying to organize GStreamer 'multithreaded' element. It should has one
sink and one source pad and perform a time consuming operation on each video
frame. In order to provide real-time processing (30 fps) I would like to
dispatch the operation to workers pool and then gather all results in a
queue (maybe priority queue based on timecode).

Does GStreamer provide such facilities? Are there any examples? Or
well-known approaches which I'm not aware of.

Thanks in advance.




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

Re: GStreamer workers to speed up a GstElement

GStreamer-devel mailing list
Le vendredi 28 mai 2021 à 06:15 -0500, darksidds via gstreamer-devel a écrit :
> I'm trying to organize GStreamer 'multithreaded' element. It should has one
> sink and one source pad and perform a time consuming operation on each video
> frame. In order to provide real-time processing (30 fps) I would like to
> dispatch the operation to workers pool and then gather all results in a
> queue (maybe priority queue based on timecode).
>
> Does GStreamer provide such facilities? Are there any examples? Or
> well-known approaches which I'm not aware of.

The final method will depend on the parallelism method used. GStreamer is using
GLib as it's OS abstraction, and GLib provide thread pools and synchronisation
primitives required. Additionally, you can you use GstPad task for streaming
thread.

GStreamer unfortunately does not have a global worker thread pool that would
allow multiple element to cooperate in multi-threading. There is a Rust
implement set of element, threadshare, that implement such cooperation though.

>
> Thanks in advance.
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.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: GStreamer workers to speed up a GstElement

GStreamer-devel mailing list
In reply to this post by GStreamer-devel mailing list
On Fri, 2021-05-28 at 06:15 -0500, darksidds via gstreamer-devel wrote:
I'm trying to organize GStreamer 'multithreaded' element. It should has one
sink and one source pad and perform a time consuming operation on each video
frame. In order to provide real-time processing (30 fps) I would like to
dispatch the operation to workers pool and then gather all results in a
queue (maybe priority queue based on timecode).

Does GStreamer provide such facilities? Are there any examples? Or
well-known approaches which I'm not aware of.

There's nothing directly built into GStreamer but you can take a look at the videoconvert/videoscale elements (or rather the GstVideoConverter backing both) and the compositor element.

These are all using worker threads to do the processing in parallel on multiple CPU cores.
They also have some kind of helper type that allows splitting the problem into multiple tasks and then waiting until all are finished.

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


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