Managing lifecycle of Gstreamer application

Vineet Krishnan vineetk32 at gmail.com
Sat Apr 23 00:16:59 UTC 2022


Hello,

I have a Flask application running on Gunicorn that creates a new GStreamer
pipeline on a Start() API request (and sets the pipeline to NULL on a
stop() request)

The GStreamer pipeline operations are encapsulated in a class, and a new
instance of the class is created for each Start API invocation, and its
reference is deleted on the stop() API invocation.

The basic flow is as such -

Start API -
* Initialize class
* GObject.threads_init(), Gst.init() (and other members)
* Create new Gst.Pipeline, Gst.Elements, and set pipeline to PLAYING

Stop API -
* Send Gst.Event.EOS to the pipeline
* Set Gst.Pipeline to Gst.State.NULL

I have noticed that with repeated start/stop invocations, the process has a
lot of orphan gstreamer threads. I have tried to unref the pipeline, but
then I get strange segmentation faults in other parts of my application.

Does anyone have any pointers as to what I can try here? The python
tutorials don't do any explicit de-initialization steps.

Thanks,
Vineet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20220422/c2ede5c6/attachment.htm>


More information about the gstreamer-devel mailing list