Commit d6579912 authored by Wim Taymans's avatar Wim Taymans
Browse files

rtspsrc: make setup url in a smarter way

Make sure we always separate the base and control url parts with a / when
creating the setup url.
parent c8a02a91
...@@ -945,12 +945,25 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx) ...@@ -945,12 +945,25 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx)
* we will fail then. */ * we will fail then. */
if (g_str_has_prefix (control_url, "rtsp://")) if (g_str_has_prefix (control_url, "rtsp://"))
stream->setup_url = g_strdup (control_url); stream->setup_url = g_strdup (control_url);
else if (src->content_base) else {
stream->setup_url = const gchar *base;
g_strdup_printf ("%s%s", src->content_base, control_url); gboolean has_slash;
else
if (src->content_base)
base = src->content_base;
else if (src->req_location)
base = src->req_location;
else
base = "/";
/* check if the base ends or control starts with / */
has_slash = g_str_has_prefix (control_url, "/");
has_slash = has_slash || g_str_has_suffix (base, "/");
/* concatenate the two strings, insert / when not present */
stream->setup_url = stream->setup_url =
g_strdup_printf ("%s/%s", src->req_location, control_url); g_strdup_printf ("%s%s%s", base, has_slash ? "" : "/", control_url);
}
} }
GST_DEBUG_OBJECT (src, " setup: %s", GST_STR_NULL (stream->setup_url)); GST_DEBUG_OBJECT (src, " setup: %s", GST_STR_NULL (stream->setup_url));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment