Hey, I happened to randomly find this source and it worked as a fix for me:
Apparently the issue is setting the pipeline to NULL from the streaming thread as explained in the comment.
All I had to do for this to work was:
def dispose_src_callback(self):
if self.source_bin.set_state(Gst.State.NULL) != Gst.StateChangeReturn.SUCCESS:
logger.error(f"Couldn't set state to NULL for {self.source_bin.get_name()}")
self.source_bin = None
logger.warning("Source removed")
self.source_bin.unlink(self.rtsp_connect_element)
self.pipeline.remove(self.source_bin)
GLib.idle_add(self.dispose_src_callback)