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);