Re: Safely access a gstreamer element ( appsink) from an external thread
On Fri, 2018-06-08 at 07:03 -0700, Nostalgia wrote:
> I have this pipeline : appsrc -> omxh264enc -> capsfilter -> appsink
> I want to run this pipeline without using g_main_loop, I will send frames
> one by one to the pipeline (from external application and continuously) so I
> want to create a thread that pull buffers received by appsink. This thread
> runs indefinitely until it is signaled to stop . It keeps on trying to pull
> a buffer from the sink.
> Is it possible to do that. I am worried about trying to pull buffers from
> sink in a new thread and how I can safe access the sink (using mutex ...)
> when it is used by the gstreamer thread.
That's fine, you can push buffers into appsrc and pop buffers from
appsink from any thread you want. Generally all GStreamer element API
is thread-safe, otherwise nothing would work as GStreamer itself is
already heavily multithreaded.