Problem freeing rtspsrc resources

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problem freeing rtspsrc resources

Avishay Orpaz
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


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel