From 8e77c8155c90c17173126613e7ddc269d0ea3e28 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 12 Aug 2022 13:20:01 +0300 Subject: [PATCH] rtspsrc: Consider the actual control base URI also in case the connection URI contains a query string That is, get rid of unnecessary and wrong special-casing. This could always use gst_rtsp_url_get_request_uri_with_control() but as we only have the control base URI as string it is easier to just call gst_uri_join_strings(). Part-of: --- subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c | 40 ++++------------------ 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c index ca95536..b1afb33 100644 --- a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c +++ b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c @@ -2411,41 +2411,13 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx, if (g_str_has_prefix (control_path, "rtsp://")) stream->conninfo.location = g_strdup (control_path); else { + const gchar *base; + + base = get_aggregate_control (src); if (g_strcmp0 (control_path, "*") == 0) - control_path = ""; - /* handle url with query */ - if (src->conninfo.url && src->conninfo.url->query) { - stream->conninfo.location = - gst_rtsp_url_get_request_uri_with_control (src->conninfo.url, - control_path); - } else { - const gchar *base; - gboolean has_slash; - const gchar *slash; - const gchar *actual_control_path = NULL; - - base = get_aggregate_control (src); - has_slash = g_str_has_suffix (base, "/"); - /* manage existence or non-existence of / in control path */ - if (control_path && strlen (control_path) > 0) { - gboolean control_has_slash = g_str_has_prefix (control_path, "/"); - - actual_control_path = control_path; - if (has_slash && control_has_slash) { - if (strlen (control_path) == 1) { - actual_control_path = NULL; - } else { - actual_control_path = control_path + 1; - } - } else { - has_slash = has_slash || control_has_slash; - } - } - slash = (!has_slash && (actual_control_path != NULL)) ? "/" : ""; - /* concatenate the two strings, insert / when not present */ - stream->conninfo.location = - g_strdup_printf ("%s%s%s", base, slash, control_path); - } + control_path = g_strdup (base); + else + stream->conninfo.location = gst_uri_join_strings (base, control_path); } } GST_DEBUG_OBJECT (src, " setup: %s", -- 2.7.4