Skip to content

Commit

Permalink
demux_mkv: fix incremental indexing with single-keyframe files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wm4 committed Nov 17, 2015
1 parent 0ec35fa commit 8ff2058
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions demux/demux_mkv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8ff2058

Please sign in to comment.