From a6a9207c4298081d2af237edd04e337e5d175e0d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 24 Jan 2007 16:25:55 +0000 Subject: [PATCH] gst/rtsp/gstrtspsrc.*: Only unblock the udp pads when we linked and activated them all. Original commit message from CVS: * gst/rtsp/gstrtspsrc.c: (pad_blocked), (gst_rtspsrc_stream_configure_transport), (gst_rtspsrc_activate_streams), (gst_rtspsrc_loop_udp): * gst/rtsp/gstrtspsrc.h: Only unblock the udp pads when we linked and activated them all. Fixes #395688. --- ChangeLog | 9 +++++++++ gst/rtsp/gstrtspsrc.c | 30 +++++++++++++++++++++--------- gst/rtsp/gstrtspsrc.h | 1 + 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85f0d46..fc27e6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2007-01-24 Wim Taymans + * gst/rtsp/gstrtspsrc.c: (pad_blocked), + (gst_rtspsrc_stream_configure_transport), + (gst_rtspsrc_activate_streams), (gst_rtspsrc_loop_udp): + * gst/rtsp/gstrtspsrc.h: + Only unblock the udp pads when we linked and activated them all. + Fixes #395688. + +2007-01-24 Wim Taymans + * gst/rtp/Makefile.am: * gst/rtp/gstrtp.c: (plugin_init): * gst/rtp/gstrtpac3depay.c: (gst_rtp_ac3_depay_base_init), diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index b56265c..44d1b05 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -860,17 +860,12 @@ pad_blocked (GstPad * pad, gboolean blocked, GstRTSPSrc * src) gst_rtspsrc_activate_streams (src); -unblock: - /* now unblock and let it stream */ - gst_pad_set_blocked_async (pad, FALSE, (GstPadBlockCallback) pad_unblocked, - src); - return; was_ok: { GST_OBJECT_UNLOCK (src); - goto unblock; + return; } } @@ -994,7 +989,7 @@ gst_rtspsrc_stream_configure_transport (GstRTSPStream * stream, gst_object_sink (stream->udpsrc[0]); /* change state */ - gst_element_set_state (stream->udpsrc[0], GST_STATE_PAUSED); + gst_element_set_state (stream->udpsrc[0], GST_STATE_READY); } /* creating another UDP source */ @@ -1010,7 +1005,7 @@ gst_rtspsrc_stream_configure_transport (GstRTSPStream * stream, gst_object_ref (stream->udpsrc[0]); gst_object_sink (stream->udpsrc[0]); - gst_element_set_state (stream->udpsrc[1], GST_STATE_PAUSED); + gst_element_set_state (stream->udpsrc[1], GST_STATE_READY); } } @@ -1033,6 +1028,9 @@ gst_rtspsrc_stream_configure_transport (GstRTSPStream * stream, /* get output pad of the UDP source. */ outpad = gst_element_get_pad (stream->udpsrc[0], "src"); + /* save it so we can unblock */ + stream->blockedpad = outpad; + /* configure pad block on the pad. As soon as there is dataflow on the * UDP source, we know that UDP is not blocked by a firewall and we can * configure all the streams to let the application autoplug decoders. */ @@ -1139,6 +1137,17 @@ gst_rtspsrc_activate_streams (GstRTSPSrc * src) * we are done */ gst_element_no_more_pads (GST_ELEMENT_CAST (src)); + /* unblock all pads */ + for (walk = src->streams; walk; walk = g_list_next (walk)) { + GstRTSPStream *stream = (GstRTSPStream *) walk->data; + + if (stream->blockedpad) { + gst_pad_set_blocked_async (stream->blockedpad, FALSE, + (GstPadBlockCallback) pad_unblocked, src); + stream->blockedpad = NULL; + } + } + return TRUE; } @@ -1388,7 +1397,10 @@ gst_rtspsrc_loop_udp (GstRTSPSrc * src) if (src->loop_cmd == CMD_RECONNECT) { /* FIXME, when we get here we have to reconnect using tcp */ src->loop_cmd = CMD_WAIT; - restart = TRUE; + + /* only restart when the pads were not yet activated, else we were + * streaming over UDP */ + restart = src->need_activate; } GST_OBJECT_UNLOCK (src); diff --git a/gst/rtsp/gstrtspsrc.h b/gst/rtsp/gstrtspsrc.h index fa030b4..8f42895 100644 --- a/gst/rtsp/gstrtspsrc.h +++ b/gst/rtsp/gstrtspsrc.h @@ -92,6 +92,7 @@ struct _GstRTSPStream { /* our udp sources */ GstElement *udpsrc[2]; + GstPad *blockedpad; /* our udp sink back to the server */ GstElement *udpsink; -- 2.7.4