mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
mssdemux2: Use gsturi structure to form fragment urls
Utilize gsturi to form fragment url paths. A token query may contain the string "manifest" and this would lead to improper url creations. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2859>
This commit is contained in:
parent
a14df98ff4
commit
3cd79c4262
1 changed files with 22 additions and 13 deletions
|
@ -267,11 +267,20 @@ gst_mss_demux_stream_update_fragment_info (GstAdaptiveDemux2Stream * stream)
|
|||
ret = gst_mss_stream_get_fragment_url (mssstream->manifest_stream, &path);
|
||||
|
||||
if (ret == GST_FLOW_OK) {
|
||||
stream->fragment.uri = g_strdup_printf ("%s/%s", mssdemux->base_url, path);
|
||||
GstUri *base_url, *frag_url;
|
||||
|
||||
base_url = gst_uri_from_string (mssdemux->base_url);
|
||||
frag_url = gst_uri_from_string_with_base (base_url, path);
|
||||
|
||||
g_free (stream->fragment.uri);
|
||||
stream->fragment.uri = gst_uri_to_string (frag_url);
|
||||
stream->fragment.stream_time =
|
||||
gst_mss_stream_get_fragment_gst_timestamp (mssstream->manifest_stream);
|
||||
stream->fragment.duration =
|
||||
gst_mss_stream_get_fragment_gst_duration (mssstream->manifest_stream);
|
||||
|
||||
gst_uri_unref (base_url);
|
||||
gst_uri_unref (frag_url);
|
||||
}
|
||||
g_free (path);
|
||||
|
||||
|
@ -458,25 +467,25 @@ static void
|
|||
gst_mss_demux_update_base_url (GstMssDemux * mssdemux)
|
||||
{
|
||||
GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (mssdemux);
|
||||
gchar *baseurl_end;
|
||||
GstUri *base_url;
|
||||
gchar *path;
|
||||
|
||||
g_free (mssdemux->base_url);
|
||||
|
||||
mssdemux->base_url =
|
||||
g_strdup (demux->manifest_base_uri ? demux->manifest_base_uri : demux->
|
||||
manifest_uri);
|
||||
baseurl_end = g_strrstr (mssdemux->base_url, "/Manifest");
|
||||
if (baseurl_end == NULL) {
|
||||
/* second try */
|
||||
baseurl_end = g_strrstr (mssdemux->base_url, "/manifest");
|
||||
}
|
||||
if (baseurl_end) {
|
||||
/* set the new end of the string */
|
||||
baseurl_end[0] = '\0';
|
||||
} else {
|
||||
GST_WARNING_OBJECT (mssdemux, "Stream's URI didn't end with /manifest");
|
||||
}
|
||||
|
||||
base_url = gst_uri_from_string (mssdemux->base_url);
|
||||
path = gst_uri_get_path (base_url);
|
||||
GST_DEBUG ("%s", path);
|
||||
|
||||
if (!g_str_has_suffix (path, "/Manifest")
|
||||
&& !g_str_has_suffix (path, "/manifest"))
|
||||
GST_WARNING_OBJECT (mssdemux, "Stream's URI didn't end with /manifest");
|
||||
|
||||
g_free (path);
|
||||
gst_uri_unref (base_url);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
Loading…
Reference in a new issue