mirror of https://github.com/mpv-player/mpv
ac1c5e6e18
Fixes test7.mkv from the Matroska test file collection, as well as some real broken files I've found in the wild. (Unfortunately, true recovery requires resetting the decoders and playback state with a manual seek, but it's still better than just exiting.) If there are broken EBML elements, try harder to skip them correctly. Do this by searching for the next cluster element. The cluster element intentionally has a long ID, so it's a suitable element for resynchronizing (mkvmerge does something similar). We know that data is corrupt if the ID or length fields of an element are malformed. Additionally, if skipping an unknown element goes past the end of the file, we assume it's corrupt and undo the seek. Do this because it often happens that corrupt data is interpreted as correct EBML elements. Since these elements will have a ridiculous values in their length fields due to the large value range that is possible (0-2^56-2), they will go past the end of the file. So instead of skipping them (which would result in playback termination), try to find the next cluster instead. (We still skip unknown elements that are within the file, as this is needed for correct operation. Also, we first execute the seek, because we don't really know where the file ends. Doing it this way is better for unseekable streams too, because it will still work in the non-error case.) This is done as special case in the packet reading function only. On the other hand, that's the only part of the file that's read after initialization is done. |
||
---|---|---|
.. | ||
asf.h | ||
asfguid.h | ||
asfheader.c | ||
asfheader.h | ||
aviheader.c | ||
aviheader.h | ||
aviprint.c | ||
aviprint.h | ||
codec_tags.c | ||
codec_tags.h | ||
demux.c | ||
demux.h | ||
demux_asf.c | ||
demux_avi.c | ||
demux_cue.c | ||
demux_edl.c | ||
demux_lavf.c | ||
demux_mf.c | ||
demux_mkv.c | ||
demux_mng.c | ||
demux_mpg.c | ||
demux_packet.h | ||
demux_rawaudio.c | ||
demux_rawvideo.c | ||
demux_ts.c | ||
demux_ts.h | ||
ebml.c | ||
ebml.h | ||
extension.c | ||
matroska.h | ||
mf.c | ||
mf.h | ||
mp3_hdr.c | ||
mp3_hdr.h | ||
mpeg_hdr.c | ||
mpeg_hdr.h | ||
ms_hdr.h | ||
parse_es.c | ||
parse_es.h | ||
stheader.h | ||
video.c |