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.
This commit is contained in:
wm4 committed 2015-11-17 21:43:35 +01:00
1 parent 0ec35fa111
commit 8ff2058681
1 file changed
+1 -2
+1 -2
View File
@@ -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;