From 668ef84171fa1a4dfb709a4c0d5d497a5425427f Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Wed, 9 Jul 2025 00:44:36 +0200 Subject: [PATCH] rtmp2src: fix playback of URIs without a playpath ffmpeg manages to play RTMP URLs in the form: ``` protocol://servername:port/appname ``` and does not require a second component to the path, adapt our code to allow using such URLs as `tcUrl`. Part-of: --- .../gst/rtmp2/gstrtmp2locationhandler.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst/rtmp2/gstrtmp2locationhandler.c b/subprojects/gst-plugins-bad/gst/rtmp2/gstrtmp2locationhandler.c index 861d5065d7..b3213a0e04 100644 --- a/subprojects/gst-plugins-bad/gst/rtmp2/gstrtmp2locationhandler.c +++ b/subprojects/gst-plugins-bad/gst/rtmp2/gstrtmp2locationhandler.c @@ -173,11 +173,6 @@ uri_handler_set_uri (GstURIHandler * handler, const gchar * string, } stream_sep = strrchr (path_sep + 1, '/'); - if (!stream_sep) { - g_set_error (error, GST_URI_ERROR, GST_URI_ERROR_BAD_REFERENCE, - "URI lacks stream: %s", string); - return FALSE; - } { gchar *string_without_path = g_strndup (string, path_sep - string); @@ -213,8 +208,10 @@ uri_handler_set_uri (GstURIHandler * handler, const gchar * string, } { - const gchar *path = path_sep + 1, *stream = stream_sep + 1; - gchar *application = g_strndup (path, stream_sep - path); + const gchar *path = path_sep + 1; + const gchar *stream = stream_sep ? stream_sep + 1 : ""; + gchar *application = + stream_sep ? g_strndup (path, stream_sep - path) : g_strdup (path); GST_DEBUG_OBJECT (self, "setting location to %s://%s:%u/%s stream %s", gst_rtmp_scheme_to_string (scheme), host, port, application, stream);