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"
This commit is contained in:
wm4 2019-06-10 23:23:49 +02:00
parent 73a48ff47b
commit e8ff816ccd
1 changed files with 2 additions and 1 deletions

View File

@ -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);
}