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.)
This commit is contained in:
wm4 2020-02-28 00:59:11 +01:00
parent 2b628d4352
commit 3ae4094ec0
1 changed files with 3 additions and 1 deletions

View File

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