mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2877>
This commit is contained in:
parent
54e29f0244
commit
7f9d689572
1 changed files with 6 additions and 34 deletions
|
@ -2385,41 +2385,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",
|
||||
|
|
Loading…
Reference in a new issue