dashdemux: Rewrite ISOBMFF & SIDX handling

The previous code was handling both as separate steps and then tried to
combine the results, but this resulted in all kinds of bugs which showed
themselves as failures during seeking and offset tracking getting wrong.
This also showed itself with gst-validate on the sample stream.

The rewritten code now parses everything in one go and tracks the
current offset only once, and as a side effect simplifies the code a
lot.

Also added is detection of SIDX that point to other SIDX instead of
actual media segments, e.g. with this stream:
  http://dash.akamaized.net/dash264/TestCases/1a/sony/SNE_DASH_SD_CASE1A_REVISED.mpd
Support for this will have to be added at some point but that should
also be easier with the rewritten code.

https://bugzilla.gnome.org/show_bug.cgi?id=781233
This commit is contained in:
Sebastian Dröge 2017-04-12 20:01:40 +03:00
parent 22c037df6c
commit db57a3b04f
3 changed files with 340 additions and 426 deletions

File diff suppressed because it is too large Load diff

View file

@ -67,25 +67,25 @@ struct _GstDashDemuxStream
GstMediaFragmentInfo current_fragment;
/* index parsing */
GstAdapter *sidx_adapter;
GstSidxParser sidx_parser;
GstClockTime sidx_position;
gint64 sidx_base_offset;
gboolean allow_sidx;
GstClockTime pending_seek_ts;
/* sidx offset tracking */
guint64 sidx_current_offset;
GstAdapter *adapter;
/* current offset of the first byte in the adapter / last byte we pushed or
* dropped*/
guint64 current_offset;
/* index = 1, header = 2, data = 3 */
guint sidx_index_header_or_data;
guint current_index_header_or_data;
/* ISOBMFF box parsing */
gboolean is_isobmff;
GstAdapter *isobmff_adapter;
struct {
/* index = 1, header = 2, data = 3 */
guint index_header_or_data;
guint32 current_fourcc;
guint64 current_start_offset;
guint64 current_offset;
guint64 current_size;
} isobmff_parser;

View file

@ -4790,9 +4790,6 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream,
GST_DEBUG ("Looking at fragment sequence chunk %d / %d", index,
stream->segments->len);
if (segment->start > ts)
break;
end_time =
gst_mpdparser_get_segment_end_time (client, stream->segments,
segment, index);