mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-21 09:53:47 +00:00
mpdparser: Handle invalid external xml link for AdaptationSet element
Ignore invalid xml link for AdaptationSet likewise external Period without error. https://bugzilla.gnome.org/show_bug.cgi?id=774463
This commit is contained in:
parent
e454694f0a
commit
ae8759c33e
1 changed files with 21 additions and 27 deletions
|
@ -229,8 +229,7 @@ static GstUri *combine_urls (GstUri * base, GList * list, gchar ** query,
|
||||||
static GList *gst_mpd_client_fetch_external_period (GstMpdClient * client,
|
static GList *gst_mpd_client_fetch_external_period (GstMpdClient * client,
|
||||||
GstPeriodNode * period_node);
|
GstPeriodNode * period_node);
|
||||||
static GList *gst_mpd_client_fetch_external_adaptation_set (GstMpdClient *
|
static GList *gst_mpd_client_fetch_external_adaptation_set (GstMpdClient *
|
||||||
client, GstPeriodNode * period, GstAdaptationSetNode * adapt_set,
|
client, GstPeriodNode * period, GstAdaptationSetNode * adapt_set);
|
||||||
gboolean * error);
|
|
||||||
|
|
||||||
struct GstMpdParserUtcTimingMethod
|
struct GstMpdParserUtcTimingMethod
|
||||||
{
|
{
|
||||||
|
@ -3692,14 +3691,10 @@ gst_mpd_client_fetch_on_load_external_resources (GstMpdClient * client)
|
||||||
if (adapt_set->xlink_href
|
if (adapt_set->xlink_href
|
||||||
&& adapt_set->actuate == GST_XLINK_ACTUATE_ON_LOAD) {
|
&& adapt_set->actuate == GST_XLINK_ACTUATE_ON_LOAD) {
|
||||||
GList *new_adapt_sets, *prev, *next;
|
GList *new_adapt_sets, *prev, *next;
|
||||||
gboolean error;
|
|
||||||
|
|
||||||
new_adapt_sets =
|
new_adapt_sets =
|
||||||
gst_mpd_client_fetch_external_adaptation_set (client, period,
|
gst_mpd_client_fetch_external_adaptation_set (client, period,
|
||||||
adapt_set, &error);
|
adapt_set);
|
||||||
|
|
||||||
if (!new_adapt_sets && error)
|
|
||||||
goto syntax_error;
|
|
||||||
|
|
||||||
prev = l->prev;
|
prev = l->prev;
|
||||||
period->AdaptationSets = g_list_delete_link (period->AdaptationSets, l);
|
period->AdaptationSets = g_list_delete_link (period->AdaptationSets, l);
|
||||||
|
@ -4545,20 +4540,18 @@ syntax_error:
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
gst_mpd_client_fetch_external_adaptation_set (GstMpdClient * client,
|
gst_mpd_client_fetch_external_adaptation_set (GstMpdClient * client,
|
||||||
GstPeriodNode * period, GstAdaptationSetNode * adapt_set, gboolean * error)
|
GstPeriodNode * period, GstAdaptationSetNode * adapt_set)
|
||||||
{
|
{
|
||||||
GstFragment *download;
|
GstFragment *download;
|
||||||
GstBuffer *adapt_set_buffer;
|
GstBuffer *adapt_set_buffer;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc = NULL;
|
||||||
GstUri *base_uri, *uri;
|
GstUri *base_uri, *uri;
|
||||||
gchar *query = NULL;
|
gchar *query = NULL;
|
||||||
gchar *uri_string;
|
gchar *uri_string;
|
||||||
GList *new_adapt_sets = NULL;
|
GList *new_adapt_sets = NULL;
|
||||||
|
|
||||||
*error = FALSE;
|
|
||||||
|
|
||||||
/* ISO/IEC 23009-1:2014 5.5.3 4)
|
/* ISO/IEC 23009-1:2014 5.5.3 4)
|
||||||
* Remove nodes that resolve to nothing when resolving
|
* Remove nodes that resolve to nothing when resolving
|
||||||
*/
|
*/
|
||||||
|
@ -4567,7 +4560,6 @@ gst_mpd_client_fetch_external_adaptation_set (GstMpdClient * client,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!client->downloader) {
|
if (!client->downloader) {
|
||||||
*error = TRUE;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4601,7 +4593,6 @@ gst_mpd_client_fetch_external_adaptation_set (GstMpdClient * client,
|
||||||
GST_ERROR ("Failed to download external AdaptationSet node at '%s': %s",
|
GST_ERROR ("Failed to download external AdaptationSet node at '%s': %s",
|
||||||
adapt_set->xlink_href, err->message);
|
adapt_set->xlink_href, err->message);
|
||||||
g_clear_error (&err);
|
g_clear_error (&err);
|
||||||
*error = TRUE;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4613,31 +4604,35 @@ gst_mpd_client_fetch_external_adaptation_set (GstMpdClient * client,
|
||||||
doc =
|
doc =
|
||||||
xmlReadMemory ((const gchar *) map.data, map.size, "noname.xml", NULL,
|
xmlReadMemory ((const gchar *) map.data, map.size, "noname.xml", NULL,
|
||||||
XML_PARSE_NONET);
|
XML_PARSE_NONET);
|
||||||
|
|
||||||
|
gst_buffer_unmap (adapt_set_buffer, &map);
|
||||||
|
gst_buffer_unref (adapt_set_buffer);
|
||||||
|
|
||||||
|
/* NOTE: ISO/IEC 23009-1:2014 5.3.3.2 is saying that exactly one AdaptationSet
|
||||||
|
* in external xml is allowed */
|
||||||
if (doc) {
|
if (doc) {
|
||||||
xmlNode *root_element = xmlDocGetRootElement (doc);
|
xmlNode *root_element = xmlDocGetRootElement (doc);
|
||||||
|
|
||||||
if (root_element->type != XML_ELEMENT_NODE ||
|
if (root_element->type != XML_ELEMENT_NODE ||
|
||||||
xmlStrcmp (root_element->name, (xmlChar *) "AdaptationSet") != 0) {
|
xmlStrcmp (root_element->name, (xmlChar *) "AdaptationSet") != 0) {
|
||||||
xmlFreeDoc (doc);
|
goto error;
|
||||||
gst_buffer_unmap (adapt_set_buffer, &map);
|
|
||||||
gst_buffer_unref (adapt_set_buffer);
|
|
||||||
*error = TRUE;
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_mpdparser_parse_adaptation_set_node (&new_adapt_sets, root_element,
|
gst_mpdparser_parse_adaptation_set_node (&new_adapt_sets, root_element,
|
||||||
period);
|
period);
|
||||||
} else {
|
} else {
|
||||||
GST_ERROR ("Failed to parse adaptation set node XML");
|
goto error;
|
||||||
gst_buffer_unmap (adapt_set_buffer, &map);
|
|
||||||
gst_buffer_unref (adapt_set_buffer);
|
|
||||||
*error = TRUE;
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
gst_buffer_unmap (adapt_set_buffer, &map);
|
|
||||||
gst_buffer_unref (adapt_set_buffer);
|
done:
|
||||||
|
if (doc)
|
||||||
|
xmlFreeDoc (doc);
|
||||||
|
|
||||||
return new_adapt_sets;
|
return new_adapt_sets;
|
||||||
|
|
||||||
|
error:
|
||||||
|
GST_ERROR ("Failed to parse adaptation set node XML");
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
|
@ -4656,7 +4651,6 @@ gst_mpd_client_get_adaptation_sets_for_period (GstMpdClient * client,
|
||||||
/* advanced explicitely below */ ) {
|
/* advanced explicitely below */ ) {
|
||||||
GstAdaptationSetNode *adapt_set = (GstAdaptationSetNode *) list->data;
|
GstAdaptationSetNode *adapt_set = (GstAdaptationSetNode *) list->data;
|
||||||
GList *new_adapt_sets = NULL, *prev, *next;
|
GList *new_adapt_sets = NULL, *prev, *next;
|
||||||
gboolean error;
|
|
||||||
|
|
||||||
if (!adapt_set->xlink_href) {
|
if (!adapt_set->xlink_href) {
|
||||||
list = list->next;
|
list = list->next;
|
||||||
|
@ -4665,7 +4659,7 @@ gst_mpd_client_get_adaptation_sets_for_period (GstMpdClient * client,
|
||||||
|
|
||||||
new_adapt_sets =
|
new_adapt_sets =
|
||||||
gst_mpd_client_fetch_external_adaptation_set (client, period->period,
|
gst_mpd_client_fetch_external_adaptation_set (client, period->period,
|
||||||
adapt_set, &error);
|
adapt_set);
|
||||||
|
|
||||||
prev = list->prev;
|
prev = list->prev;
|
||||||
period->period->AdaptationSets =
|
period->period->AdaptationSets =
|
||||||
|
|
Loading…
Reference in a new issue