"free(): invalid pointer" when passing STRUCTURE_CHANGE message to Gst.Pipeline parent object
I have some code that subclasses Gst.Pipeline
and overrides the do_handle_message
method. After reacting to the message, I pass it to the parent class do_handle_message
method.
class MyPipeline(Gst.Pipeline):
def do_handle_message(self, message):
# Some code
Gst.Pipeline.do_handle_message(self, message)
I've noticed that when passing messages of type STRUCTURE_CHANGE
with this method, I get a free(): invalid pointer
error and a warning about an assertion failing earlier in the code. I haven't found any other message types that have this behavior.
(my Python file):31: Warning: g_atomic_ref_count_dec: assertion 'g_atomic_int_get (arc) > 0' failed
videotestsrc.link(autovideosink)
free(): invalid pointer
I suspect this may be related to the fact that STRUCTURE_CHANGE
messages hold a reference to a Gst.Element
that may not be getting reference counted properly.
Software | Version |
---|---|
CPython | 3.6 |
PyGObject | 3.36.0 |
GStreamer | 1.16.2 |
OS | Arch Linux |
Full example:
from time import sleep
from threading import Thread
import gi
gi.require_version("Gst", "1.0")
from gi.repository import Gst, GLib
Gst.init()
main_loop = GLib.MainLoop.new(context=None, is_running=False)
thread = Thread(target=main_loop.run, daemon=True)
thread.start()
class MyPipeline(Gst.Pipeline):
def do_handle_message(self, message):
Gst.Pipeline.do_handle_message(self, message)
pipeline = MyPipeline()
videotestsrc = Gst.ElementFactory.make("videotestsrc")
pipeline.add(videotestsrc)
autovideosink = Gst.ElementFactory.make("autovideosink")
pipeline.add(autovideosink)
videotestsrc.link(autovideosink)
pipeline.set_state(Gst.State.PLAYING)
while True:
try:
sleep(0.1)
except KeyboardInterrupt:
break
main_loop.quit()
thread.join()