Problem freeing rtspsrc resources

Avishay Orpaz avishorp at gmail.com
Sun May 24 09:24:03 UTC 2020


I have a system that consumes video from an RTSP source, using the rtspsrc
element. The source  may occasionally fail, so whenever I detect a failure,
I'm trying to re-create the pipeline in a loop until the pipeline becomes
live again. The problem is that apparently rtspsrc does not clean up
completely. When running lsof on the program, I see more and more stream
resources being consumed, until the point in which the operating system
stops the whole program.

Here's a small snippet that recreates the problem:

#!/usr/bin/python3
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GLib
import time

gpipe = None

def proc_message(bus, message):
    global gpipe
    if (message.type == Gst.MessageType.ERROR):
        gpipe.set_state(Gst.State.NULL)
        time.sleep(1)
        gpipe = create_pipe()

def create_pipe():
    pipe = Gst.parse_launch('rtspsrc location=rtsp://localhost:1000 !
fakesink')
    pipe.get_bus().add_signal_watch()
    pipe.get_bus().connect("message", proc_message)
    pipe.set_state(Gst.State.PLAYING)
    return pipe

Gst.init(None)
gpipe = create_pipe();
GLib.MainLoop().run()

The environment is Gstremer from git head (also tried released 1.16, same
problem) on Ubuntu 18.04.

Avishay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200524/32d26e90/attachment.htm>


More information about the gstreamer-devel mailing list