From 3ae4094ec0eba49781ddb4eaf489fc7f0e97a237 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 28 Feb 2020 00:59:11 +0100 Subject: 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.) --- demux/demux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } } -- cgit v1.2.3