summaryrefslogtreecommitdiffstats
path: root/gst/rtsp
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2009-09-25 14:14:03 +0200
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2009-09-25 16:47:39 +0200
commit50d5c8dce5b02ccb2aa8e8f9fb0e90b393021e26 (patch)
tree0a9eda03e9d3a93e8a6464ce73b4071bbf0c7d10 /gst/rtsp
parent03f46a42e59a2729327c51b3ee77abdaf022b38e (diff)
rtspsrc: if transport protocol unsupported, try another one
Also change error message to more accurately reflect cases in which it can occur.
Diffstat (limited to 'gst/rtsp')
-rw-r--r--gst/rtsp/gstrtspsrc.c42
1 files changed, 35 insertions, 7 deletions
diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c
index 0490dc68..7f16146f 100644
--- a/gst/rtsp/gstrtspsrc.c
+++ b/gst/rtsp/gstrtspsrc.c
@@ -3982,6 +3982,15 @@ no_setup:
}
}
+/* masks to be kept in sync with the hardcoded protocol order of preference
+ * in code below */
+static guint protocol_masks[] = {
+ GST_RTSP_LOWER_TRANS_UDP,
+ GST_RTSP_LOWER_TRANS_UDP_MCAST,
+ GST_RTSP_LOWER_TRANS_TCP,
+ 0
+};
+
static GstRTSPResult
gst_rtspsrc_create_transports_string (GstRTSPSrc * src,
GstRTSPLowerTrans protocols, gchar ** transports)
@@ -4185,6 +4194,7 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src)
for (walk = src->streams; walk; walk = g_list_next (walk)) {
gchar *transports;
gint retry = 0;
+ guint mask = 0;
stream = (GstRTSPStream *) walk->data;
@@ -4225,9 +4235,18 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src)
GST_DEBUG_OBJECT (src, "doing setup of stream %p with %s", stream,
stream->setup_url);
+ /* first selectable protocol */
+ while (protocol_masks[mask] && !(protocols & protocol_masks[mask]))
+ mask++;
+ if (!protocol_masks[mask])
+ goto no_protocols;
+
retry:
- /* create a string with all the transports */
- res = gst_rtspsrc_create_transports_string (src, protocols, &transports);
+ GST_DEBUG_OBJECT (src, "protocols = 0x%x, protocol mask = 0x%x", protocols,
+ protocol_masks[mask]);
+ /* create a string with first transport in line */
+ res = gst_rtspsrc_create_transports_string (src,
+ protocols & protocol_masks[mask], &transports);
if (res < 0)
goto setup_transport_failed;
@@ -4281,12 +4300,20 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src)
retry++;
goto retry;
}
- /* give up on this stream and move to the next stream,
- * but not without doing some postprocessing so we can
+ /* this transport did not go down well, but we may have others to try
+ * that we did not send yet, try those and only give up then
+ * but not without checking for lost cause/extension so we can
* post a nicer/more useful error message later */
if (!unsupported_real)
unsupported_real = gst_rtspsrc_stream_is_real_media (stream);
- continue;
+ /* select next available protocol, give up on this stream if none */
+ mask++;
+ while (protocol_masks[mask] && !(protocols & protocol_masks[mask]))
+ mask++;
+ if (!protocol_masks[mask] || unsupported_real)
+ continue;
+ else
+ goto retry;
default:
/* cleanup of leftover transport and move to the next stream */
gst_rtspsrc_stream_free_udp (stream);
@@ -4430,8 +4457,9 @@ nothing_to_activate:
(NULL));
} else {
GST_ELEMENT_ERROR (src, STREAM, CODEC_NOT_FOUND,
- (_("No supported stream was found. You might be missing the right "
- "GStreamer RTSP extension plugin.")), (NULL));
+ (_("No supported stream was found. You might need to allow "
+ "more transport protocols or may otherwise be missing "
+ "the right GStreamer RTSP extension plugin.")), (NULL));
}
return FALSE;
}