This fixes the situation when there are not enough entries in the index
(e.g. on initial seek there's only one index entry in the index) and index
search returns just the last known entry. That causes seeking function just to
seek there instead of trying harder to get at the requested position.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
... | ... |
@@ -330,7 +330,8 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, |
330 | 330 |
int64_t pos, pts; |
331 | 331 |
|
332 | 332 |
/* if found, seek there */ |
333 |
- if (index >= 0){ |
|
333 |
+ if (index >= 0 && |
|
334 |
+ timestamp <= st->index_entries[st->nb_index_entries - 1].timestamp) { |
|
334 | 335 |
wc->block_parsed = 1; |
335 | 336 |
avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); |
336 | 337 |
return 0; |