Shared gstreamer pipeline's element (for example appsink) with multiple threads

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

Shared gstreamer pipeline's element (for example appsink) with multiple threads

Nostalgia
This post was updated on .
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.

Hope that someone could clarify if it is possible or not to do that ...
Regards,



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

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

Sebastian Dröge-3
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

_______________________________________________
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: Safely access a gstreamer element ( appsink) from an external thread

Nostalgia
Hi Sebastian Dröge-3,

Thanks for your reply. I have another question about topic, Is it necessary
to use the g_main_loop when you want to use the ''
gst_app_sink_set_callbacks " ? because when I use callbacks I obtain
segmentation fault.

Regards



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel