summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-17 21:43:35 +0100
committerwm4 <wm4@nowhere>2015-11-17 21:43:35 +0100
commit8ff205868136368bb8a096eb5dc0fac07fe2c50d (patch)
treeba9ddae874faca5696b8e3b4ec962da3d698fa11
parent0ec35fa111391b8069640ba2f616746a1b5530a5 (diff)
downloadmpv-8ff205868136368bb8a096eb5dc0fac07fe2c50d.tar.bz2
mpv-8ff205868136368bb8a096eb5dc0fac07fe2c50d.tar.xz
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.
-rw-r--r--demux/demux_mkv.c3
1 files changed, 1 insertions, 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;