dashdemux: index segment url generated from template is not properly used
Submitted by Florin Apostol
According to the standard:
126.96.36.199.4 Index Segment information
"The presence of explicit Index Segment information is indicated
- by the presence of SegmentTemplate@index attribute. If either $Number$ or $Time$ are present the Template-based Segment URL construction in 188.8.131.52.4 shall be applied with number set to the number of the corresponding Media Segment. If not present, the SegmentTemplate@index attribute constitutes a reference to Representation Index."
So, depending on the presence of $Number$ or $Time$ in the template, the resulting url should be interpreted differently: if one of them is present, the url points to a index segment for a media segment and thus should be downloaded every time the corresponding media segment is downloaded. If $Number$ or $Time$ are not present, the generated url points to a RepresentationIndex which contains the IndexSegment for the entire representation, so it should be downloaded only once at the beginning.
But the function gst_mpdparser_build_URL_from_template does not indicate to the caller if $Number$ or $Time$ were used, so the caller is unable to differentiate between the 2 situations.
Currently the index segment is downloaded by the gst_adaptive_demux_stream_download_header_fragment based on information provided by gst_dash_demux_stream_update_headers_info which calls gst_mpd_client_get_next_header_index. But this function will generate an index segment uri by forcing number and time to 0, which is obvious wrong and will generate a wrong index url.