summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-02-28 00:59:11 +0100
committerwm4 <wm4@nowhere>2020-02-28 00:59:11 +0100
commit3ae4094ec0eba49781ddb4eaf489fc7f0e97a237 (patch)
treee97bedb30b52cdb7063071179e915d2ca1a559ab
parent2b628d4352de09c5ec4663d2dfeebd4e11065f74 (diff)
downloadmpv-3ae4094ec0eba49781ddb4eaf489fc7f0e97a237.tar.bz2
mpv-3ae4094ec0eba49781ddb4eaf489fc7f0e97a237.tar.xz
demux: make seek ranges work for static images + audio
In this case the video track has seek_start == seek_end, and due to the "seek_start >= seek_end" condition, this was considered broken, and no seek range was created, breaking cached seeking. Fix this by allowing the case if they're equal, and a valid timestamp. (NB: seeking backward in this will still jump to position 0, because it is the video timestamp. This is unfortunately how it's supposed to work. HR-seeks will also do this, but decode and skip the entire audio until the seek target, so it will mostly appear to work.)
-rw-r--r--demux/demux.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/demux/demux.c b/demux/demux.c
index fe2b7c41ca..e5df920c22 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -630,7 +630,9 @@ static void update_seek_ranges(struct demux_cached_range *range)
range->is_bof &= queue->is_bof;
bool empty = queue->is_eof && !queue->head;
- if (queue->seek_start >= queue->seek_end && !empty)
+ if (queue->seek_start >= queue->seek_end && !empty &&
+ !(queue->seek_start == queue->seek_end &&
+ queue->seek_start != MP_NOPTS_VALUE))
goto broken;
}
}