mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2675>
This commit is contained in:
parent
0513e51716
commit
37366ff2f4
1 changed files with 9 additions and 0 deletions
|
@ -732,13 +732,22 @@ def deinit_pygst():
|
||||||
real_init = Gst.init
|
real_init = Gst.init
|
||||||
def init(argv):
|
def init(argv):
|
||||||
init_pygst()
|
init_pygst()
|
||||||
|
|
||||||
|
if Gst.is_initialized():
|
||||||
|
return True
|
||||||
|
|
||||||
return real_init(argv)
|
return real_init(argv)
|
||||||
|
|
||||||
Gst.init = init
|
Gst.init = init
|
||||||
|
|
||||||
real_init_check = Gst.init_check
|
real_init_check = Gst.init_check
|
||||||
def init_check(argv):
|
def init_check(argv):
|
||||||
init_pygst()
|
init_pygst()
|
||||||
|
if Gst.is_initialized():
|
||||||
|
return True
|
||||||
|
|
||||||
return real_init_check(argv)
|
return real_init_check(argv)
|
||||||
|
|
||||||
Gst.init_check = init_check
|
Gst.init_check = init_check
|
||||||
|
|
||||||
real_deinit = Gst.deinit
|
real_deinit = Gst.deinit
|
||||||
|
|
Loading…
Reference in a new issue