summaryrefslogtreecommitdiff
path: root/ext/dash
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-18 19:04:57 +0200
commitbe465a139b402a8ebe67f00054bff9f05502e12c (patch)
tree572757cd4cb1501c894c1882242dda5d6a3ab6f9 /ext/dash
parentd5eee3191813b83be1ced6b84a11f553037c188a (diff)
downloadgstreamer-plugins-bad-be465a139b402a8ebe67f00054bff9f05502e12c.tar.gz
dashdemux: Use correct (sub) fragment start when clipping chunk size
If we didn't download anything yet, we shouldn't use fragment.start but the start position of the current sidx entry.
Diffstat (limited to 'ext/dash')
-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 8e1bf1b3a..d78d144f3 100644
--- a/ext/dash/gstdashdemux.c
+++ b/ext/dash/gstdashdemux.c
@@ -2702,20 +2702,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;
@@ -2732,13 +2735,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) {