Commit d3662bae authored by Patrick Radizi's avatar Patrick Radizi Committed by Sebastian Dröge

rtspsrc: send GstRTSPSrcTimeout message on timeout

The GstRTSPSrcTimeout message is sent by the rtspsrc when it receives
the on-timeout signal from rtpsession. This can be used by an
application for error handling.

gstreamer/gst-plugins-good#499
parent ab8100e6
......@@ -42,6 +42,7 @@
*/
/**
* SECTION:element-rtspsrc
* @title: rtspsrc
*
* Makes a connection to an RTSP server and read the data.
* rtspsrc strictly follows RFC 2326 and therefore does not (yet) support
......@@ -66,13 +67,24 @@
* rtspsrc acts like a live source and will therefore only generate data in the
* PLAYING state.
*
* <refsect2>
* <title>Example launch line</title>
* If a RTP session times out then the rtspsrc will generate an element message
* named "GstRTSPSrcTimeout". Currently this is only supported for timeouts
* triggered by RTCP.
*
* The message's structure contains three fields:
*
* #GstRTSPSrcTimeoutCause `cause`: the cause of the timeout.
*
* #gint `stream-number`: an internal identifier of the stream that timed out.
*
* #guint `ssrc`: the SSRC of the stream that timed out.
*
* ## Example launch line
* |[
* gst-launch-1.0 rtspsrc location=rtsp://some.server/url ! fakesink
* ]| Establish a connection to an RTSP server and send the raw RTP packets to a
* fakesink.
* </refsect2>
*
*/
#ifdef HAVE_CONFIG_H
......@@ -3410,7 +3422,7 @@ on_bye_ssrc (GObject * session, GObject * source, GstRTSPStream * stream)
}
static void
on_timeout (GObject * session, GObject * source, GstRTSPStream * stream)
on_timeout_common (GObject * session, GObject * source, GstRTSPStream * stream)
{
GstRTSPSrc *src = stream->parent;
guint ssrc;
......@@ -3424,6 +3436,22 @@ on_timeout (GObject * session, GObject * source, GstRTSPStream * stream)
gst_rtspsrc_do_stream_eos (src, stream);
}
static void
on_timeout (GObject * session, GObject * source, GstRTSPStream * stream)
{
GstRTSPSrc *src = stream->parent;
/* timeout, post element message */
gst_element_post_message (GST_ELEMENT_CAST (src),
gst_message_new_element (GST_OBJECT_CAST (src),
gst_structure_new ("GstRTSPSrcTimeout",
"cause", G_TYPE_ENUM, GST_RTSP_SRC_TIMEOUT_CAUSE_RTCP,
"stream-number", G_TYPE_INT, stream->id, "ssrc", G_TYPE_UINT,
stream->ssrc, NULL)));
on_timeout_common (session, source, stream);
}
static void
on_npt_stop (GstElement * rtpbin, guint session, guint ssrc, GstRTSPSrc * src)
{
......@@ -3941,8 +3969,8 @@ gst_rtspsrc_stream_configure_manager (GstRTSPSrc * src, GstRTSPStream * stream,
g_signal_connect (rtpsession, "on-bye-ssrc", (GCallback) on_bye_ssrc,
stream);
g_signal_connect (rtpsession, "on-bye-timeout", (GCallback) on_timeout,
stream);
g_signal_connect (rtpsession, "on-bye-timeout",
(GCallback) on_timeout_common, stream);
g_signal_connect (rtpsession, "on-timeout", (GCallback) on_timeout,
stream);
g_signal_connect (rtpsession, "on-ssrc-active",
......
......@@ -169,6 +169,18 @@ struct _GstRTSPStream {
GstStructure *rtx_pt_map;
};
/**
* GstRTSPSrcTimeoutCause:
* @GST_RTSP_SRC_TIMEOUT_CAUSE_RTCP: timeout triggered by RTCP
*
* Different causes to why the rtspsrc generated the GstRTSPSrcTimeout
* message.
*/
typedef enum
{
GST_RTSP_SRC_TIMEOUT_CAUSE_RTCP
} GstRTSPSrcTimeoutCause;
/**
* GstRTSPNatMethod:
* @GST_RTSP_NAT_NONE: none
......@@ -182,6 +194,7 @@ typedef enum
GST_RTSP_NAT_DUMMY
} GstRTSPNatMethod;
struct _GstRTSPSrc {
GstBin parent;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment