From 5ebbde7327f3a6f7946fd7d59116b93c933d3f83 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 20 May 2019 02:36:25 +0200 Subject: demux: don't adjust internal backward playback seeks by start time Only timestamps that enter or leave the demuxer API should be adjusted by ts_offset (which is usually the start time). queue_seek() is also used by backward demux seeks, which uses an internal timestamp. --- demux/demux.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/demux/demux.c b/demux/demux.c index 92121c9b7b..019a8469c7 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -3171,7 +3171,12 @@ int demux_seek(demuxer_t *demuxer, double seek_pts, int flags) assert(demuxer == in->d_user); pthread_mutex_lock(&in->lock); + + if (!(flags & SEEK_FACTOR)) + seek_pts = MP_ADD_PTS(seek_pts, -in->ts_offset); + int res = queue_seek(in, seek_pts, flags, true); + pthread_cond_signal(&in->wakeup); pthread_mutex_unlock(&in->lock); @@ -3187,9 +3192,6 @@ static bool queue_seek(struct demux_internal *in, double seek_pts, int flags, MP_VERBOSE(in, "queuing seek to %f%s\n", seek_pts, in->seeking ? " (cascade)" : ""); - if (!(flags & SEEK_FACTOR)) - seek_pts = MP_ADD_PTS(seek_pts, -in->ts_offset); - bool require_cache = flags & SEEK_CACHED; flags &= ~(unsigned)SEEK_CACHED; -- cgit v1.2.3