From 37366ff2f4baf37306092fd8c844b7c0bfa36f08 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 28 Jun 2022 11:02:37 -0400 Subject: [PATCH] python: Do not call gst_init when it is already is_initialized GStreamer plugins written in python need to call `Gst.init` to ensure that GStreamer is initialized so when loading a python plugin, we might be recursively calling `gst_init` which is not a good idea. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/940 Part-of: --- subprojects/gst-python/gi/overrides/Gst.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/subprojects/gst-python/gi/overrides/Gst.py b/subprojects/gst-python/gi/overrides/Gst.py index 1d5a44efcc..cef36d6496 100644 --- a/subprojects/gst-python/gi/overrides/Gst.py +++ b/subprojects/gst-python/gi/overrides/Gst.py @@ -732,13 +732,22 @@ def deinit_pygst(): real_init = Gst.init def init(argv): init_pygst() + + if Gst.is_initialized(): + return True + return real_init(argv) + Gst.init = init real_init_check = Gst.init_check def init_check(argv): init_pygst() + if Gst.is_initialized(): + return True + return real_init_check(argv) + Gst.init_check = init_check real_deinit = Gst.deinit