dashdemux: index uri is not set when only the index range is provided
Submitted by Florin Apostol
Link to original bug (#752721)
Description
For the index@SegmentURL attribute, the standard mentions:
"If not present and the @indexRange present, then the @media attribute is mapped to the @index. If the @media attribute is not present either, then any BaseURL element is mapped to the @index attribute and the @indexRange attribute shall be present."
The implementation does not set the index uri in this scenario. The code is at the end of gst_mpd_client_get_next_fragment function:
if (indexURL != NULL) {
frag_url = gst_uri_make_writable (gst_uri_from_string_with_base (base_url,
indexURL));
gst_uri_set_query_string (frag_url, stream->queryURL);
fragment->index_uri = gst_uri_to_string (frag_url);
gst_uri_unref (frag_url);
g_free (indexURL);
} else if (indexURL == NULL && (fragment->index_range_start
|| fragment->index_range_end != -1)) {
/* index has no specific URL but has a range, we should only use this if
* the media also has a range, otherwise we are serving some data twice
* (in the media fragment and again in the index) /
if (!(fragment->range_start || fragment->range_end != -1)) {
GST_WARNING ("Ignoring index ranges because there isn't a media range "
"and URIs would be the same");
/ removing index information */
fragment->index_range_start = 0;
fragment->index_range_end = -1;
}
}
The "else if" checks to see if it will retrieve the same data for index and media segment. But it fails to set the fragment->index_uri in case it wants the segment index to be downloaded. Because fragment->index_uri remains null, no segment index will be downloaded.
On the other hand, in chapter "5.3.9.5.4 Index Segment information" the standard mentions:
"The @indexRange attribute may also be used to provide the byte range for an index within a Media Segment, where this is allowed by the Media Segment format. In this case the @index attribute shall not be present and the range specified shall lie completely within any byte range specified for the Media Segment."
So, in this case the index will be completely inside the media segment. If we really do not want to download and provide the same data twice (in index and in media segment) the whole "else if" should be removed and an appropriate comment describing the situation should be added instead.