Managing lifecycle of Gstreamer application

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


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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list