summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-06-10 23:23:49 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commite8ff816ccd3c430bc4d74b37f94f10a74c79ab34 (patch)
treeded40fb6c4f3c8c77d9e1fad6819d5ee6aaf921c
parent73a48ff47b93b9d2d5a499236a50bc6f4c4d5604 (diff)
downloadmpv-e8ff816ccd3c430bc4d74b37f94f10a74c79ab34.tar.bz2
mpv-e8ff816ccd3c430bc4d74b37f94f10a74c79ab34.tar.xz
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"
-rw-r--r--demux/demux.c3
1 files changed, 2 insertions, 1 deletions
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);
}