summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-03-22 12:04:35 +0200
committerSebastian Dröge <sebastian@centricular.com>2017-03-22 12:06:33 +0200
commitb8b2946e03305cc60ac17b7df9437aad58c22a03 (patch)
tree7dfd4e1c12814f369d609e6722c529d78c8e234f /ext
parent19eba961d20b796277b3af5762e9c07b4364bfb6 (diff)
downloadgstreamer-plugins-bad-b8b2946e03305cc60ac17b7df9437aad58c22a03.tar.gz
dashdemux: In reverse playback mode, if seeking to the beginning of a fragment, start with the previous one instead
There's no point to start downloading a fragment just to output 1ns.
Diffstat (limited to 'ext')
-rw-r--r--ext/dash/gstdashdemux.c4
-rw-r--r--ext/dash/gstmpdparser.c5
2 files changed, 9 insertions, 0 deletions
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c
index 461ec7fab..0af18c2bb 100644
--- a/ext/dash/gstdashdemux.c
+++ b/ext/dash/gstdashdemux.c
@@ -1290,6 +1290,10 @@ gst_dash_demux_stream_sidx_seek (GstDashDemuxStream * dashstream,
/* FIXME in reverse mode, if we are exactly at a fragment start it makes more
* sense to start from the end of the previous fragment */
+ if (!forward && idx > 0 && entry->pts == ts) {
+ idx--;
+ entry = &sidx->entries[idx];
+ }
/* Now entry->pts <= ts < entry->pts + entry->duration, need to adjust for
* snapping */
diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c
index a1d4cdace..944370191 100644
--- a/ext/dash/gstmpdparser.c
+++ b/ext/dash/gstmpdparser.c
@@ -4864,6 +4864,11 @@ gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream,
ts = 0;
index = ts / duration;
+
+ /* At the end of a segment in reverse mode, start from the previous fragment */
+ if (!forward && index > 0 && ts % duration == 0)
+ index--;
+
index_time = index * duration;
if ((flags & GST_SEEK_FLAG_SNAP_NEAREST) == GST_SEEK_FLAG_SNAP_NEAREST) {