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.
This commit is contained in:
Sebastian Dröge 2017-03-22 12:04:35 +02:00
parent 19eba961d2
commit b8b2946e03
2 changed files with 9 additions and 0 deletions

View file

@ -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 */

View file

@ -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) {