From e8ff816ccd3c430bc4d74b37f94f10a74c79ab34 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 10 Jun 2019 23:23:49 +0200 Subject: demux: fix excessive backwards seeking with backwards playback Backwards demuxing usually seeks back back by a "random" amount (set by a user option) when it needs new preceding packets. It turns out a past change made these backwards seek amounts add up when it didn't need to (i.e. subtracting the amount from the seek pos without properly resetting it), which could possibly slow down playback as it went on. The reason for this was that back_seek_pos was set for every stream on every seek. This made the reset not affect other streams (in particular streams which weren't used and never were reset, or which didn't reset that often). But as the commit adding it showed, this is needed only to set the initial position. So do that. Fixes: "demux: fix initial backward demuxing state in some cases" --- demux/demux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/demux/demux.c b/demux/demux.c index 2ef95127dc..928aabf8bb 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -3460,7 +3460,8 @@ static bool queue_seek(struct demux_internal *in, double seek_pts, int flags, // Process possibly cached packets. if (in->back_demuxing) { - ds->back_seek_pos = seek_pts; + if (ds->back_seek_pos == MP_NOPTS_VALUE) + ds->back_seek_pos = seek_pts; back_demux_see_packets(in->streams[n]->ds); } -- cgit v1.2.3