From 8ff205868136368bb8a096eb5dc0fac07fe2c50d Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 17 Nov 2015 21:43:35 +0100 Subject: demux_mkv: fix incremental indexing with single-keyframe files This is another regression of the recently added start time probing. If a seek is executed after opening the file (but before reading any packets), the first block is discarded instead of indexed. If there are no other keyframes in the file, seeking will fail completely. Fix it by seeking to the cluster start if there aren't any index entries yet. This will read the skipped packet again. Fixes #2498. --- demux/demux_mkv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index 733e441feb..a11691b317 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -2659,8 +2659,7 @@ static int create_index_until(struct demuxer *demuxer, uint64_t timecode) mkv_index_t *index = get_highest_index_entry(demuxer); if (!index || index->timecode * mkv_d->tc_scale < timecode) { - if (index) - stream_seek(s, index->filepos); + stream_seek(s, index ? index->filepos : mkv_d->cluster_start); MP_VERBOSE(demuxer, "creating index until TC %" PRIu64 "\n", timecode); for (;;) { int res; -- cgit v1.2.3