From d08e0ccc48aaf1d9d2aaff27460ef060cb86e085 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Tue, 9 Aug 2011 11:28:17 +0200 Subject: [PATCH] rtspsrc: Properly error out if SDP contains no streams Also fixes unitialized variable error on macosx. --- gst/rtsp/gstrtspsrc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 7b1a9d7780..c0b3753d1b 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -5000,7 +5000,7 @@ static GstRTSPResult gst_rtspsrc_setup_streams (GstRTSPSrc * src, gboolean async) { GList *walk; - GstRTSPResult res; + GstRTSPResult res = GST_RTSP_ERROR; GstRTSPMessage request = { 0 }; GstRTSPMessage response = { 0 }; GstRTSPStream *stream = NULL; @@ -5032,6 +5032,9 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src, gboolean async) src->next_port_num = src->client_port_range.min; rtpport = rtcpport = 0; + if (G_UNLIKELY (src->streams == NULL)) + goto no_streams; + for (walk = src->streams; walk; walk = g_list_next (walk)) { GstRTSPConnection *conn; gchar *transports; @@ -5284,6 +5287,12 @@ no_protocols: ("Could not connect to server, no protocols left")); return GST_RTSP_ERROR; } +no_streams: + { + GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL), + ("SDP contains no streams")); + return GST_RTSP_ERROR; + } create_request_failed: { gchar *str = gst_rtsp_strresult (res);