From 7eb37e25750b1461875e698a03b310706dcfbe5b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 17 Sep 2007 02:05:14 +0000 Subject: [PATCH] gst/rtsp/gstrtspsrc.c: Give meaningfull error when all streams failed to configure for some reason. Original commit message from CVS: * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_setup_streams), (gst_rtspsrc_dup_printf): Give meaningfull error when all streams failed to configure for some reason. --- ChangeLog | 7 +++++++ gst/rtsp/gstrtspsrc.c | 22 ++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6d8c39dfdd..d66cfad7aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-09-16 Wim Taymans + + * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_setup_streams), + (gst_rtspsrc_dup_printf): + Give meaningfull error when all streams failed to configure for some + reason. + 2007-09-16 Wim Taymans * gst/rtp/README: diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 689aa2035e..e0ca536122 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -3384,6 +3384,7 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src) /* reset some state */ src->free_channel = 0; src->interleaved = FALSE; + src->need_activate = FALSE; for (walk = src->streams; walk; walk = g_list_next (walk)) { gchar *transports; @@ -3478,8 +3479,10 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src) goto no_transport; /* parse transport, go to next stream on parse error */ - if (gst_rtsp_transport_parse (resptrans, &transport) != GST_RTSP_OK) - continue; + if (gst_rtsp_transport_parse (resptrans, &transport) != GST_RTSP_OK) { + GST_WARNING_OBJECT (src, "failed to parse transport %s", resptrans); + goto next; + } /* update allowed transports for other streams. once the transport of * one stream has been determined, we make sure that all other streams @@ -3518,8 +3521,12 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src) GST_DEBUG_OBJECT (src, "could not configure stream %p transport, skipping stream", stream); + goto next; } } + /* we need to activate at least one streams when we detect activity */ + src->need_activate = TRUE; + next: /* clean up our transport struct */ gst_rtsp_transport_init (&transport); } @@ -3527,8 +3534,9 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src) gst_rtsp_ext_list_stream_select (src->extensions, src->url); - /* we need to activate the streams when we detect activity */ - src->need_activate = TRUE; + /* if there is nothing to activate, error out */ + if (!src->need_activate) + goto nothing_to_activate; return TRUE; @@ -3570,6 +3578,12 @@ no_transport: ("Server did not select transport.")); goto cleanup_error; } +nothing_to_activate: + { + GST_ELEMENT_ERROR (src, STREAM, FORMAT, (NULL), + ("No supported stream was found.")); + return FALSE; + } cleanup_error: { gst_rtsp_message_unset (&request);