summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungha Yang <sh.yang@lge.com>2017-04-12 16:58:10 +0900
committerThiago Santos <thiagossantos@gmail.com>2017-04-15 18:33:41 -0700
commit68ac72431c3e68346ee918580bf41d7f0f90929d (patch)
tree299d80d511116e2cfa98003b0e7dd61d892439ba
parent6167dab39ee0f8c683f0ab840ceaa005780cfa5e (diff)
downloadgstreamer-plugins-bad-68ac72431c3e68346ee918580bf41d7f0f90929d.tar.gz
mpdparser: Do sanity check of Segment Base Information only at Repesentation level
Spec 5.3.9.2 is saying about the existence of duration and SegmentTimeline only for Representation level. Other level such as Period or AdaptationSet might not have the attributes. https://bugzilla.gnome.org/show_bug.cgi?id=780570
-rw-r--r--ext/dash/gstmpdparser.c44
1 files changed, 8 insertions, 36 deletions
diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c
index 33340a498..b07c02f4b 100644
--- a/ext/dash/gstmpdparser.c
+++ b/ext/dash/gstmpdparser.c
@@ -1588,7 +1588,7 @@ gst_mpdparser_parse_mult_seg_base_type_ext (GstMultSegmentBaseType ** pointer,
{
xmlNode *cur_node;
GstMultSegmentBaseType *mult_seg_base_type;
- guint intval, do_sanity_check;
+ guint intval;
gboolean has_timeline = FALSE, has_duration = FALSE;
gst_mpdparser_free_mult_seg_base_type_ext (*pointer);
@@ -1611,9 +1611,12 @@ gst_mpdparser_parse_mult_seg_base_type_ext (GstMultSegmentBaseType ** pointer,
if (gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "duration", 0,
&intval)) {
mult_seg_base_type->duration = intval;
- has_duration = TRUE;
}
+ /* duration might be specified from parent */
+ if (mult_seg_base_type->duration)
+ has_duration = TRUE;
+
if (gst_mpdparser_get_xml_prop_unsigned_integer (a_node, "startNumber", 1,
&intval)) {
mult_seg_base_type->startNumber = intval;
@@ -1641,40 +1644,9 @@ gst_mpdparser_parse_mult_seg_base_type_ext (GstMultSegmentBaseType ** pointer,
has_timeline = mult_seg_base_type->SegmentTimeline != NULL;
- /* check if timeline and duration are valid for this representation:
- * do not check, if _all_ Representation-siblings have SegmentTemplate-childs
- * no sub-SegmentTemplates: we are the essential node and must have timeline
- * and duration: check it
- * all Representations have own SegmentTemplates: don't check here , the
- * check is done in the SegmentTemplate childs of the Representations
- */
-#define SANITY_CHECK_REASON_NO_SUBTEMPLATES 0x02
-#define SANITY_CHECK_REASON_TOPLEVEL_TEMPLATE 0x01
- /* loop through all Representation-siblings and look for SegmentTemplate
- * childs. */
- do_sanity_check = SANITY_CHECK_REASON_NO_SUBTEMPLATES; /* preset: no subseqs */
- for (cur_node = a_node->parent->children; cur_node; cur_node = cur_node->next) {
- if (cur_node->type == XML_ELEMENT_NODE) {
- if (xmlStrcmp (cur_node->name, (xmlChar *) "Representation") == 0) {
- /* in Representation: look for SegmentTemplate child */
- xmlNode *sub_node;
- gboolean have_segmenttemplate = FALSE;
- for (sub_node = cur_node->children; sub_node; sub_node = sub_node->next) {
- if (sub_node->type == XML_ELEMENT_NODE) {
- if (xmlStrcmp (sub_node->name, (xmlChar *) "SegmentTemplate") == 0) {
- have_segmenttemplate = TRUE;
- }
- }
- }
- if (have_segmenttemplate)
- do_sanity_check &= ~SANITY_CHECK_REASON_NO_SUBTEMPLATES;
- else /* found Representation without SegmentTemplate: sanity necessary */
- do_sanity_check |= SANITY_CHECK_REASON_TOPLEVEL_TEMPLATE;
- }
- }
- }
-
- if (do_sanity_check && !has_duration && !has_timeline) {
+ /* Checking duration and timeline only at Representation's child level */
+ if (xmlStrcmp (a_node->parent->name, (xmlChar *) "Representation") == 0
+ && !has_duration && !has_timeline) {
GST_ERROR ("segment has neither duration nor timeline");
goto error;
}