• Andreas Rheinhardt's avatar
    avformat/matroskadec: Don't abort resyncing upon seek failure · 27f40b1d
    Andreas Rheinhardt authored
    When an error happens, the Matroska demuxer tries to resync to level 1
    elements from an earlier position onwards. If the seek to said earlier
    position fails, the demuxer currently treats this as an unrecoverable
    error. And that behaviour is suboptimal as said failure is nothing
    unrecoverable or unexpected (when the input isn't seekable).
    It is preferable to simply resync from the earliest position available
    (i.e. the start of the AVIOContext's buffer) onwards if the seek failed.
    
    Here are some scenarios that might be treated as unrecoverable errors
    by the current code if the input isn't seekable. They all have in
    common that the current position is so far away from the desired
    position that the seek can't be fulfilled from the AVIOContext's buffer:
    
    1. Blocks (both SimpleBlocks as well as a Block in a BlockGroup) for
    which reading them as binary EBML elements succeeds, but whose parsing
    triggers an error (e.g. an invalid TrackNumber). In this case the
    earlier position from which resyncing begins is at the start of the block
    (or even earlier).
    2. BlockGroups, whose parsing fails in one of the latter elements. Just
    as in 1., the start of the BlockGroup (the target of the seek) might be
    so far away from the current position that it is no longer in the
    buffer.
    3. At the beginning of parsing a cluster, the cluster is parsed until a
    SimpleBlock or a BlockGroup is encountered. So if the input is damaged
    between the beginning of the cluster and the first occurrence of a
    SimpleBlock/BlockGroup and if said damage makes the demuxer read/skip so
    much data that the beginning of the cluster is no longer in the buffer,
    demuxing will currently fail completely.
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    27f40b1d
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
ffbuild Loading commit data...
fftools Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libpostproc Loading commit data...
libswresample Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING.md Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
INSTALL.md Loading commit data...
LICENSE.md Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
RELEASE Loading commit data...
configure Loading commit data...