Running every GStremer pipeline into a separate (GLib) thread

pvv pvv at milestone.dk
Fri Jun 12 11:57:17 UTC 2020


First of all excuse me for the stupid question as I;m a newbie in the
GStreamer development.

I've read part of the documentation and most of the samples, but there is
one thing I cannot understand completely. (Well there are more of course but
this is the most interesting one :-))
All of the samples are initializing GLib main tread trough the some form of:

loop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(loop);

As far as I understood this mail loop is used for all the signals
processing.
Also Bus messages are processed in it.

So I'm a little bit concerned what will happen if I run multiple pipelines
simultaneously.
Or there is an issue/improper implementation in some of them.

Most probably for heavy loads the best solution is pipelines to be separated
to multiple processes, thus mitigating all the possible problems with memory
leaks, hangs, dead locks etc., without affecting the main 
application.

Anyway at least running them into separate threads will be beneficial. 

Obviously it is possible to be started more than one GLib main thread, with
creation of the GMainContext first. But I cannot understand (apparently I'm
missing knowledge) how after that to "assign" them to pipelines or signaling
to them, etc.
For example in "g_signal_connect" and "g_signal_emit" is not specified on
which "main" thread to be executed.

Some posts here claim it is possible (GStreamer supports different main
thread), but I wasn't able to find details.

Similar problem is discussed in this  thread
<http://gstreamer-devel.966125.n4.nabble.com/how-to-make-gstreamer-run-in-separate-thread-td1960435.html>  
but to be honest I wasn't able to understand it.

In  this StackOverflow post
<https://stackoverflow.com/questions/26410585/add-callback-for-separate-g-main-loop>  
is discussed how timeouts could be attached to different GLib main threads. 
I suppose that something similar could be made and for the GStreamer
pipelines and objects, but I'm not sure.

Could someone enlighten me a little bit, please ?
Thanks in advance !




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list