After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 752714 - dashdemux: index information returned by gst_mpd_client_get_next_fragment is not used
dashdemux: index information returned by gst_mpd_client_get_next_fragment is ...
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-07-22 12:34 UTC by Florin Apostol
Modified: 2018-11-03 13:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch 1/2 (3.51 KB, patch)
2015-07-29 13:13 UTC, Florin Apostol
committed Details | Review
patch 2/2 (22.89 KB, patch)
2015-07-29 13:15 UTC, Florin Apostol
none Details | Review
updated patch 2/2 (22.15 KB, patch)
2015-07-31 11:10 UTC, Florin Apostol
reviewed Details | Review

Description Florin Apostol 2015-07-22 12:34:33 UTC
The gst_mpd_client_get_next_fragment function will set the index information for each media segment. But this information is never used by the caller function gst_dash_demux_stream_update_fragment_info. The stream->fragment data is set with all other information except the index related ones.

But even if the gst_dash_demux_stream_update_fragment_info function will properly update the index information on stream->fragment, the gstadaptivedemux is written such that the index is downloaded only when the header is retrieved (in the gst_adaptive_demux_stream_download_header_fragment function). 

I believe the index downloading code should be moved from gst_adaptive_demux_stream_download_header_fragment to gst_adaptive_demux_stream_download_fragment so that it is attempted for each media fragment. According to the standard, each media segment can have its own segment index, so gstadaptivedemux should try to get all of them, not just the first one.

I don't have any real life examples that use segment index. If some could be provided, I could test this and provide a patch.
Comment 1 Florin Apostol 2015-07-29 13:13:48 UTC
Created attachment 308392 [details] [review]
patch 1/2
Comment 3 Thiago Sousa Santos 2015-07-30 18:32:49 UTC
Review of attachment 308394 [details] [review]:

::: ext/dash/gstmpdparser.c
@@ +2540,3 @@
 gst_mpdparser_build_URL_from_template (const gchar * url_template,
+    const gchar * id, guint number, guint bandwidth, guint64 time,
+    gboolean * used_number_or_time)

What do you think of making this an input parameter instead? The user would set if it wants any index, global index or segment index. This way you enforce the caller to select what kind of index it wants rather than returning anything and expeting a post-call check.

The reason for enforcing is that with time people tend to forget these small details of the code and this post-check might be forgotten when the code evolves.

What do you think?
Comment 4 Florin Apostol 2015-07-31 11:10:45 UTC
Created attachment 308528 [details] [review]
updated patch 2/2

updated patch 2/2 based on received comments: gst_mpdparser_build_URL_from_template now has an input parameter
Comment 5 Thiago Sousa Santos 2015-08-01 00:32:40 UTC
Review of attachment 308392 [details] [review]:

Looks good, will push with the other once it is ready.
Comment 6 Thiago Sousa Santos 2015-08-01 00:34:45 UTC
Review of attachment 308528 [details] [review]:

::: ext/dash/gstmpdparser.c
@@ +3869,3 @@
+        ignore_index = TRUE;
+      }
+    }

This seems unaligned with what adaptivedemux expects.

If you return the index range only when it is inside the media range then there is not really a reason to expose it as downloading the media range will already include the index. Downloading the index and then the media will make the index be downloaded twice.

Is it allowed on spec to have the index outside of the media range?
Comment 7 Florin Apostol 2015-08-03 09:18:49 UTC
In case @index attribute is missing and @indexRange is present, the spec mandates that the index is inside the media segment. I believe isoff is the only one that supports this.

There is a reason for downloading the index first. In case of switching representations, the index is downloaded first in order to reposition the stream. The media is downloaded starting from the current position. So, it avoids re-downloading the elapsed media segment.

And the index is not downloaded twice. The gst_dash_demux_stream_update_fragment_info function, in case of isombff, will consider the media to start after the index ends, so it does not download the index again.
Comment 8 Sebastian Dröge (slomo) 2015-08-27 08:20:29 UTC
What's the status here?
Comment 9 Florin Apostol 2015-09-07 10:01:50 UTC
I have nothing to add at this moment. But it should be reviewed carefully, possible also by other people, because it introduces significant changes in the way indexes are handled and maybe I missed some scenarios.
Comment 10 Vincent Penquerc'h 2015-09-16 15:43:05 UTC
Review of attachment 308528 [details] [review]:

::: ext/dash/gstdashdemux.c
@@ +934,3 @@
+    } else {
+      /* header did not configure index, take values from fragment */
+      stream->fragment.index_uri = fragment.index_uri;

I think this might need a strdup. gst_dash_demux_stream_update_headers_info allocates for stream->fragment.index_uri, and gst_adaptive_demux_stream_fragment_clear calls g_free. Not super sure though, as there is some similar code below that does not allocate either...
Comment 11 Florin Apostol 2015-09-16 16:21:51 UTC
Review of attachment 308528 [details] [review]:

::: ext/dash/gstdashdemux.c
@@ +934,3 @@
+    } else {
+      /* header did not configure index, take values from fragment */
+      stream->fragment.index_uri = fragment.index_uri;

no, it doesn't.
fragment variable is being used to get the data from gst_mpd_client_get_next_fragment function. When the fragment variable is destroyed, it does not free the contained strings. The caller of gst_mpd_client_get_next_fragment function (in this case gst_dash_demux_stream_update_fragment_info) will take 
ownership of the data from fragment variable.
Comment 12 Sebastian Dröge (slomo) 2015-10-02 14:22:20 UTC
What's the status here now?
Comment 13 Florin Apostol 2015-10-02 14:31:58 UTC
I still have nothing to add at this moment. But it should be reviewed carefully, possible also by other people, because it introduces significant changes in the way indexes are handled and maybe I missed some scenarios.
Comment 14 Vincent Penquerc'h 2015-11-02 11:40:51 UTC
commit 19d604e92f621401c00bef46381866dde0d5b08b
Author: Florin Apostol <florin.apostol@oregan.net>
Date:   Mon Nov 2 11:17:29 2015 +0000

    dashdemux: remove unreachable code
    
    The stream->cur_seg_template is set to the lowest available segment
    template (representation or adaptation or period, in this order).
    Because the template elements are inherited, the lowest template will
    have all the elements the parents had, so there is no need to check the
    parent for an element that is not found in the child (eg initialisation
    or index).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752714
Comment 15 Thiago Sousa Santos 2015-11-18 22:05:01 UTC
Any real world test urls here?

I wonder what an index for a segment mans in the end. Is it a sidx for a segment? Or is it a different kind of index?
Comment 16 Florin Apostol 2015-11-19 11:21:41 UTC
My understanding is that segment index is a piece of information that clients can use to seek into the stream. And yes, sidx is one of them. But I believe there can be others.

6.2.4 Index Segment
Index Segments contain information that is related to Media Segments and primarily contain indexing information for Media Segments. An Index Segment may provide information for one or more Media Segments.
The Index Segment may be media format specific and more details shall be defined for each media format that permits Index Segments.
Comment 17 GStreamer system administrator 2018-11-03 13:37:56 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/276.