diff options
-rw-r--r-- | ext/dash/gstdashdemux.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index 0eadbcc6c..94b25a868 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -2701,20 +2701,23 @@ gst_dash_demux_need_another_chunk (GstAdaptiveDemuxStream * stream) if (gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client) && dashstream->sidx_parser.sidx.entries) { - guint64 sidx_end_offset = + guint64 sidx_start_offset = dashstream->sidx_base_offset + - SIDX_CURRENT_ENTRY (dashstream)->offset + - SIDX_CURRENT_ENTRY (dashstream)->size; + SIDX_CURRENT_ENTRY (dashstream)->offset; + guint64 sidx_end_offset = + sidx_start_offset + SIDX_CURRENT_ENTRY (dashstream)->size; guint64 downloaded_end_offset; if (dashstream->current_offset == GST_CLOCK_TIME_NONE) { - downloaded_end_offset = stream->fragment.range_start; + downloaded_end_offset = sidx_start_offset; } else { downloaded_end_offset = dashstream->current_offset + gst_adapter_available (dashstream->adapter); } + downloaded_end_offset = MAX (downloaded_end_offset, sidx_start_offset); + if (stream->fragment.chunk_size + downloaded_end_offset > sidx_end_offset) { stream->fragment.chunk_size = sidx_end_offset - downloaded_end_offset; @@ -2731,13 +2734,9 @@ gst_dash_demux_need_another_chunk (GstAdaptiveDemuxStream * stream) guint64 end_offset = sync_sample->end_offset + 1; guint64 downloaded_end_offset; - if (dashstream->current_offset == GST_CLOCK_TIME_NONE) { - downloaded_end_offset = stream->fragment.range_start; - } else { - downloaded_end_offset = - dashstream->current_offset + - gst_adapter_available (dashstream->adapter); - } + downloaded_end_offset = + dashstream->current_offset + + gst_adapter_available (dashstream->adapter); if (gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client) && dashstream->sidx_parser.sidx.entries) { |