udpsrc: error out when no protocol is specified in the uri

It is certainly better than to crash.

https://bugzilla.gnome.org/show_bug.cgi?id=658178
This commit is contained in:
Vincent Penquerc'h 2011-09-05 10:11:18 +01:00 committed by Sebastian Dröge
parent 7e4574e968
commit 3319737e5c

View file

@ -374,7 +374,10 @@ gst_udp_parse_uri (const gchar * uristr, GstUDPUri * uri)
gchar *location, *location_end; gchar *location, *location_end;
gchar *colptr; gchar *colptr;
/* consider no protocol to be udp:// */
protocol = gst_uri_get_protocol (uristr); protocol = gst_uri_get_protocol (uristr);
if (!protocol)
goto no_protocol;
if (strcmp (protocol, "udp") != 0) if (strcmp (protocol, "udp") != 0)
goto wrong_protocol; goto wrong_protocol;
g_free (protocol); g_free (protocol);
@ -425,6 +428,11 @@ gst_udp_parse_uri (const gchar * uristr, GstUDPUri * uri)
return 0; return 0;
/* ERRORS */ /* ERRORS */
no_protocol:
{
GST_ERROR ("error parsing uri %s: no protocol", uristr);
return -1;
}
wrong_protocol: wrong_protocol:
{ {
GST_ERROR ("error parsing uri %s: wrong protocol (%s != udp)", uristr, GST_ERROR ("error parsing uri %s: wrong protocol (%s != udp)", uristr,