appsink memory leak
Running the code above causes the memory to build-up non-stop
import threading
import time
import gi
import base64
gi.require_version("Gst", "1.0")
gi.require_version("GstApp", "1.0")
from gi.repository import Gst, GstApp, GLib
_ = GstApp
Gst.init()
main_loop = GLib.MainLoop()
main_loop_thread = threading.Thread(target=main_loop.run)
main_loop_thread.start()
pipeline = Gst.parse_launch("rtspsrc *** ! decodebin ! videoconvert ! jpegenc ! appsink drop=true sync=false name=sink max-buffers=1")
appsink = pipeline.get_by_name("sink")
pipeline.set_state(Gst.State.PLAYING)
while True:
sample = appsink.try_pull_sample(Gst.SECOND*10)
if sample is None:
continue
buf = sample.get_buffer()
ok, map_info = buf.map(Gst.MapFlags.READ)
if not ok:
break
pipeline.set_state(Gst.State.NULL)
main_loop.quit()
main_loop_thread.join()
Ive took a look at the docs and my guess is that this is happening because I'm not using gst_sample_unref
, but I cant find how to use this in python
Edited by jvmf1