diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-05-27 16:08:09 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2016-07-01 14:10:31 +0200 |
commit | 91e398ddd6bcf8633e511b73fbd71f1786efec20 (patch) | |
tree | 906195a9b4d993c28da8b5eb1b6b83ab1d480879 /ext | |
parent | 93746430897698a48ecfea911b30f42f017a1a70 (diff) | |
download | gstreamer-plugins-bad-91e398ddd6bcf8633e511b73fbd71f1786efec20.tar.gz |
dashdemux: Implement SIDX tracking based on buffer offset
This simplifies the code but also removes a bug with tracking of the remaining
size for the initial subfragment: we were not considering the size between the
index and the start of the first moof here.
https://bugzilla.gnome.org/show_bug.cgi?id=764684
Diffstat (limited to 'ext')
-rw-r--r-- | ext/dash/gstdashdemux.c | 21 | ||||
-rw-r--r-- | ext/dash/gstdashdemux.h | 1 |
2 files changed, 7 insertions, 15 deletions
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index 39dfd630f..c67c63598 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -1096,9 +1096,7 @@ gst_dash_demux_stream_sidx_seek (GstDashDemuxStream * dashstream, gint idx = sidx->entries_count; /* check whether ts is already past the last element or not */ - if (sidx->entries[idx - 1].pts + sidx->entries[idx - 1].duration < ts) { - dashstream->sidx_current_remaining = 0; - } else { + if (sidx->entries[idx - 1].pts + sidx->entries[idx - 1].duration >= ts) { GstSearchMode mode = GST_SEARCH_MODE_BEFORE; if ((flags & GST_SEEK_FLAG_SNAP_NEAREST) == GST_SEEK_FLAG_SNAP_NEAREST) { @@ -1126,8 +1124,6 @@ gst_dash_demux_stream_sidx_seek (GstDashDemuxStream * dashstream, ABS (sidx->entries[idx].pts - ts)) idx += 1; } - - dashstream->sidx_current_remaining = sidx->entries[idx].size; } sidx->entry_index = idx; @@ -1208,9 +1204,6 @@ gst_dash_demux_stream_advance_subfragment (GstAdaptiveDemuxStream * stream) "Finished fragment: %d", sidx->entry_index, sidx->entries_count, fragment_finished); - if (!fragment_finished) { - dashstream->sidx_current_remaining = sidx->entries[sidx->entry_index].size; - } return !fragment_finished; } @@ -1719,8 +1712,6 @@ gst_dash_demux_data_received (GstAdaptiveDemux * demux, } else { SIDX (dash_stream)->entry_index = dash_stream->sidx_index; } - dash_stream->sidx_current_remaining = - SIDX_CURRENT_ENTRY (dash_stream)->size; } else if (consumed < available) { GstBuffer *pending; /* we still need to keep some data around for the next parsing round @@ -1742,15 +1733,17 @@ gst_dash_demux_data_received (GstAdaptiveDemux * demux, && ((available = gst_adapter_available (dash_stream->sidx_adapter)) > 0)) { gboolean advance = FALSE; + guint64 sidx_end_offset = + dash_stream->sidx_base_offset + + SIDX_CURRENT_ENTRY (dash_stream)->offset + + SIDX_CURRENT_ENTRY (dash_stream)->size; - if (available < dash_stream->sidx_current_remaining) { + if (dash_stream->sidx_current_offset + available < sidx_end_offset) { buffer = gst_adapter_take_buffer (dash_stream->sidx_adapter, available); - dash_stream->sidx_current_remaining -= available; } else { buffer = gst_adapter_take_buffer (dash_stream->sidx_adapter, - dash_stream->sidx_current_remaining); - dash_stream->sidx_current_remaining = 0; + sidx_end_offset - dash_stream->sidx_current_offset); advance = TRUE; } GST_BUFFER_OFFSET (buffer) = dash_stream->sidx_current_offset; diff --git a/ext/dash/gstdashdemux.h b/ext/dash/gstdashdemux.h index 34fb0f7b8..5f0094b5d 100644 --- a/ext/dash/gstdashdemux.h +++ b/ext/dash/gstdashdemux.h @@ -69,7 +69,6 @@ struct _GstDashDemuxStream /* index parsing */ GstAdapter *sidx_adapter; GstSidxParser sidx_parser; - gsize sidx_current_remaining; gint sidx_index; gint64 sidx_base_offset; GstClockTime pending_seek_ts; |