summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-30 20:43:06 +0100
committerwm4 <wm4@nowhere>2013-03-30 20:51:45 +0100
commit014298522875f7f41d10eb3e41fcd97926cdedee (patch)
tree04a2f600554951b19e5d596feecee9a14f55b522
parente31567fe41e853ea355b55ddb15a184b67ab9e16 (diff)
downloadmpv-014298522875f7f41d10eb3e41fcd97926cdedee.tar.bz2
mpv-014298522875f7f41d10eb3e41fcd97926cdedee.tar.xz
demux_mkv: don't print non-sense warning on normal EOF
Commit ac1c5e6 (demux_mkv: improve robustness against broken files) added code to skip to the next cluster on error conditions. However, reaching normal EOF triggers this code as well, so explicitly check for EOF before this happens. Note that the EOF flag is only set _after_ reading the last byte, so EOF needs to be checked after the fact. (Or in other words, we must check for EOF after the ebml_read_id() call.) (To answer the question why reading packets actually reaches EOF, even if there's the seek index between the last packet and the end of the file: the cluster reading code skips the seeking related EBML elements as normal part of operation, so it hits EOF gracefully when trying to find the next cluster.)
-rw-r--r--demux/demux_mkv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index aa6d9c21bb..400bb59ad7 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -2310,9 +2310,9 @@ static int demux_mkv_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
uint32_t id = ebml_read_id(s, &il);
if (id == MATROSKA_ID_CLUSTER)
break;
- ebml_read_skip_or_resync_cluster(s, NULL);
if (s->eof)
return 0;
+ ebml_read_skip_or_resync_cluster(s, NULL);
}
mkv_d->cluster_start = stream_tell(s) - il;
mkv_d->cluster_size = ebml_read_length(s, NULL);