rtspsrc: Properly error out if SDP contains no streams

Also fixes unitialized variable error on macosx.
This commit is contained in:
Edward Hervey 2011-08-09 11:28:17 +02:00
parent 26993420c0
commit d08e0ccc48

View file

@ -5000,7 +5000,7 @@ static GstRTSPResult
gst_rtspsrc_setup_streams (GstRTSPSrc * src, gboolean async) gst_rtspsrc_setup_streams (GstRTSPSrc * src, gboolean async)
{ {
GList *walk; GList *walk;
GstRTSPResult res; GstRTSPResult res = GST_RTSP_ERROR;
GstRTSPMessage request = { 0 }; GstRTSPMessage request = { 0 };
GstRTSPMessage response = { 0 }; GstRTSPMessage response = { 0 };
GstRTSPStream *stream = NULL; GstRTSPStream *stream = NULL;
@ -5032,6 +5032,9 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src, gboolean async)
src->next_port_num = src->client_port_range.min; src->next_port_num = src->client_port_range.min;
rtpport = rtcpport = 0; rtpport = rtcpport = 0;
if (G_UNLIKELY (src->streams == NULL))
goto no_streams;
for (walk = src->streams; walk; walk = g_list_next (walk)) { for (walk = src->streams; walk; walk = g_list_next (walk)) {
GstRTSPConnection *conn; GstRTSPConnection *conn;
gchar *transports; gchar *transports;
@ -5284,6 +5287,12 @@ no_protocols:
("Could not connect to server, no protocols left")); ("Could not connect to server, no protocols left"));
return GST_RTSP_ERROR; return GST_RTSP_ERROR;
} }
no_streams:
{
GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
("SDP contains no streams"));
return GST_RTSP_ERROR;
}
create_request_failed: create_request_failed:
{ {
gchar *str = gst_rtsp_strresult (res); gchar *str = gst_rtsp_strresult (res);