Safely access a gstreamer element ( appsink) from an external thread

Sebastian Dröge sebastian at centricular.com
Fri Jun 8 15:18:43 UTC 2018


On Fri, 2018-06-08 at 07:03 -0700, Nostalgia wrote:
> Hi,
> 
> 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.

-- 
Sebastian Dröge, Centricular Ltd · https://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20180608/c58873e3/attachment.sig>


More information about the gstreamer-devel mailing list