diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 9ecf014d47..1c450f5b7b 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -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. * - * - * Example launch line + * 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. - * + * */ #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", diff --git a/gst/rtsp/gstrtspsrc.h b/gst/rtsp/gstrtspsrc.h index b144469d32..e0b60a95d3 100644 --- a/gst/rtsp/gstrtspsrc.h +++ b/gst/rtsp/gstrtspsrc.h @@ -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;