dash: Fix the bug when inheriting segmentbase, segmentTemplate or segmentList from grandparent
Submitted by WeiChungChang
Link to original bug (#763454)
Description
Created attachment 323611
proposed solution
Fix the bug when inheriting SegmentBase, SegmentTemplate and SegmentList from upper layer.
The detail is given in the attached = report.
The issued MPD is also given in the attached.
Also a proposed patch is given.
A brief description is as below but for the detail, please refer to report.
From the attached MPD, it is expected to generate resource URLs by the SegmentTemplate table below. Unfortunately, it is not so now. For current Gstmpdparser we will get illegal address & make playback fail.
The root cause is:
Firstly We call gst_mpdparser_parse_period_node() and store the result in struct GstSegmentTemplateNode by calling gst_mpdparser_parse_segment_template_node().
Then we parse the children node and call gst_mpdparser_parse_adaptation_set_node().
At this time "SegmentTemplate" DOES NOT appear. So we have no chance to call gst_mpdparser_parse_segment_template_node(). As the result, the adaption set carries no info about "SegmentTemplate".
Finally, we parse the representation node but parent->SegmentTemplate is NULL (parent = adaption set). So representation node’s SegmentTemplate inherits nothing and only with timescale from itself.
As the result, the generated stream->cur_seg_template will only have timescale as the logic below. It misses the attribute of @index and @ initialization so we CANNOT generate a legal URL address.
[Proposed solution]
From the description above, the root cause is that we only do inherit from “parent”. However, if the desired attribute exists at the grandparent (as period’s role to representation), we will get miss.
The spec says:
“…SegmentBase, SegmentTemplate and SegmentList shall inherit attributes and elements from the same element on a higher level. If the same attribute or element is present on both levels, the one on the lower level shall take precedence over the one on the higher level. …”
According to the spec, the proposed solution is:
When we parse an adaption set and find that either one of the three elements = [ SegmentBase, SegmentTemplate and SegmentList ] DOES NOT exist but the parent (period node) holds one, we FORCE to inherit the element from period node.
Patch 323611, "proposed solution":
0001-Fix-the-issue-of-inheriting-segmentbase-segmentTempl.patch