(Re)starting rtspsrc when the source is offline

David Röthlisberger david at rothlis.net
Thu Jan 17 01:18:41 PST 2013


On 16 Jan 2013, at 17:44, Paddy wrote:
> Hi All,
> 
> I'm using gstreamer 0.10.
> 
> I'm trying to record RTSP to disk & it's going pretty well except for that
> when I try & start recording before the camera is on-line nothing happens -
> ever. Even after the camera is online.
> 
> My question is how do I get the rtspsrc to retry the connection periodically
> ??


Are you using `gst-launch` on the command line, or an application
written in C or Python?

We have a GStreamer application called "stb-tester"[1] that processes
video from a video-capture card. When that video-capture card loses
input video momentarily (e.g. because the set-top box it is connected to
reboots) the GStreamer pipeline never recovers, even after video is
re-established on the capture card's input. I don't know if this is a
fault of the GStreamer source element or of the capture card's driver.

So what we do is add a `queue` element to the pipeline and register for
the queue's `underrun` and `running` signals. When we receive an
underrun signal, we start a short timer (2 seconds) which we cancel if
we receive a subsequent `running` signal. After the 2 seconds of
underruns, we bring the pipeline down to STATE_READY, remove the source
element, create a new source element, add it to the pipeline, and set
the pipeline back to STATE_PLAYING. For details see [2].

This may or may not be the right solution for you, but at least it's an
option or it might give you some ideas.

[1] http://stb-tester.com
[2] https://github.com/drothlis/stb-tester/commit/b6135eca




More information about the gstreamer-devel mailing list