rtsp: gstrtspurl: gst_rtsp_url_get_request_uri: use rtsps scheme for tls transport methods

gst_rtsp_url_get_request_uri returns rtsp://... url when requested url is rtsps://, this is not
in accordance with https://www.rfc-editor.org/rfc/rfc7826.html#section-19.2.
This also impedes setting up a rtsps session with a live555 rtsp server.

Don't expose other than rtsp and rtsps internal gstreamer rtsp url schemes
to avoid regression:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2412

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4294>
This commit is contained in:
Bart Van Severen 2023-03-28 15:49:36 +02:00 committed by GStreamer Marge Bot
parent c2b3afd3dd
commit 65f953cd23

View file

@ -59,9 +59,11 @@
G_DEFINE_BOXED_TYPE (GstRTSPUrl, gst_rtsp_url,
(GBoxedCopyFunc) gst_rtsp_url_copy, (GBoxedFreeFunc) gst_rtsp_url_free);
#define SCHEME_SIZE 7
static const struct
{
const char scheme[6];
const char scheme[SCHEME_SIZE];
GstRTSPLowerTrans transports;
} rtsp_schemes_map[] = {
{
@ -326,6 +328,7 @@ gst_rtsp_url_get_request_uri (const GstRTSPUrl * url)
const gchar *post_host;
const gchar *pre_query;
const gchar *query;
gchar scheme[SCHEME_SIZE] = "rtsp";
g_return_val_if_fail (url != NULL, NULL);
@ -333,12 +336,14 @@ gst_rtsp_url_get_request_uri (const GstRTSPUrl * url)
post_host = url->family == GST_RTSP_FAM_INET6 ? "]" : "";
pre_query = url->query ? "?" : "";
query = url->query ? url->query : "";
if (url->transports & GST_RTSP_LOWER_TRANS_TLS)
g_strlcpy (scheme, "rtsps", SCHEME_SIZE);
if (url->port != 0) {
uri = g_strdup_printf ("rtsp://%s%s%s:%u%s%s%s", pre_host, url->host,
uri = g_strdup_printf ("%s://%s%s%s:%u%s%s%s", scheme, pre_host, url->host,
post_host, url->port, url->abspath, pre_query, query);
} else {
uri = g_strdup_printf ("rtsp://%s%s%s%s%s%s", pre_host, url->host,
uri = g_strdup_printf ("%s://%s%s%s%s%s%s", scheme, pre_host, url->host,
post_host, url->abspath, pre_query, query);
}
return uri;