summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-04-17 14:43:49 +0300
committerEdward Hervey <bilboed@bilboed.com>2017-05-15 18:12:35 +0200
commit160f666981d47c549cb42a0759ddb8712791e9ad (patch)
tree50467353fe3a5b85d6ac618bd4c38bfb15347909
parent75c33bd6ad408434b5d5659cdd366a9baf953f3e (diff)
dashdemux: Use correct (sub) fragment start when clipping chunk sizedash-take2
If we didn't download anything yet, we shouldn't use fragment.start but the start position of the current sidx entry.
-rw-r--r--ext/dash/gstdashdemux.c21
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) {