summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmi Holst Christensen <jimmi.christensen@aivero.com>2020-10-21 15:38:43 +0200
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-12-15 10:14:04 +0000
commitd1783cf3810d693bf20e9582e91de0a5155acd04 (patch)
treeca24a3685544a61e7be818a12e73d8ba2fe231ad
parent6bf45b5965d05b29a4d97576fc6075fcd69f4a7b (diff)
rtspclientsink add proper support for uri queries
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/166>
-rw-r--r--gst/rtsp-sink/gstrtspclientsink.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/gst/rtsp-sink/gstrtspclientsink.c b/gst/rtsp-sink/gstrtspclientsink.c
index 59c2125..1fbf2f6 100644
--- a/gst/rtsp-sink/gstrtspclientsink.c
+++ b/gst/rtsp-sink/gstrtspclientsink.c
@@ -3586,7 +3586,8 @@ gst_rtsp_client_sink_collect_streams (GstRTSPClientSink * sink)
GstRTSPStreamContext *context;
GList *walk;
const gchar *base;
- gboolean has_slash;
+ gchar *stream_path;
+ GstUri *base_uri, *uri;
GST_DEBUG_OBJECT (sink, "Collecting stream information");
@@ -3594,8 +3595,13 @@ gst_rtsp_client_sink_collect_streams (GstRTSPClientSink * sink)
return FALSE;
base = get_aggregate_control (sink);
- /* check if the base ends with / */
- has_slash = g_str_has_suffix (base, "/");
+
+ base_uri = gst_uri_from_string (base);
+ if (!base_uri) {
+ GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND, (NULL),
+ ("Could not parse uri %s", base));
+ return FALSE;
+ }
g_mutex_lock (&sink->preroll_lock);
while (sink->contexts == NULL && !sink->conninfo.flushing) {
@@ -3634,11 +3640,16 @@ gst_rtsp_client_sink_collect_streams (GstRTSPClientSink * sink)
gst_rtsp_client_sink_create_stream (sink, context, context->payloader,
srcpad);
- /* concatenate the two strings, insert / when not present */
+ /* append stream index to uri path */
g_free (context->conninfo.location);
- context->conninfo.location =
- g_strdup_printf ("%s%sstream=%d", base, has_slash ? "" : "/",
- context->index);
+
+ stream_path = g_strdup_printf ("stream=%d", context->index);
+ uri = gst_uri_copy (base_uri);
+ gst_uri_append_path (uri, stream_path);
+
+ context->conninfo.location = gst_uri_to_string (uri);
+ gst_uri_unref (uri);
+ g_free (stream_path);
if (sink->rtx_time > 0) {
/* enable retransmission by setting rtprtxsend as the "aux" element of rtpbin */
@@ -3675,10 +3686,12 @@ gst_rtsp_client_sink_collect_streams (GstRTSPClientSink * sink)
sink->streams_collected = TRUE;
g_mutex_unlock (&sink->preroll_lock);
+ gst_uri_unref (base_uri);
return TRUE;
join_bin_failed:
+ gst_uri_unref (base_uri);
GST_ELEMENT_ERROR (sink, RESOURCE, READ, (NULL),
("Could not start stream %d", context->index));
return FALSE;