• Andreas Rheinhardt's avatar
    h264_mp4toannexb: Don't forget numOfPictureParameterSets · 4b4f8bd4
    Andreas Rheinhardt authored
    The format of an AVCDecoderConfigurationRecord, the out-of-band
    extradata of H.264 in mp4, is as follows: First four bytes containing
    version, profile and level, one byte for the length size and one byte
    each for the number of SPS, followed by the SPS (each with its own size
    field), followed by a byte containing the number of PPS followed by the
    PPS with their size fields. While the number of SPS/PPS may be zero, the
    bytes containing these numbers are mandatory. Yet the byte containing
    the number of PPS has been ignored in two places:
    1. In the initial check for whether the extradata can contain an
    AVCDecoderConfigurationRecord. The minimum size is 7, not 6.
    2. No check is made for whether the extradata ended right after the last
    byte of the last SPS of the SPS array. Instead the first byte of the
    padding is read as if it were part of the extradata and contained the
    number of PPS (namely zero, given that the padding is zeroed). No error
    or warning was ever raised.
    This has been changed. Such truncated extradata is now considered
    invalid; the check for 2. has been incorporated into the general size
    check.
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
    Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
    4b4f8bd4
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...
.mailmap 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...