• Aman Gupta's avatar
    libavcodec/videotoolbox: fix decoding of h264 streams with minor SPS changes · 259dc4e0
    Aman Gupta authored
    Previously the codec kept an entire copy of the SPS, and restarted the VT decoder
    session whenever it changed. This fixed decoding errors in [1], as
    described in 9519983c. On further inspection, that sample features an SPS change
    from High/4.0 to High/3.2 while moving from one scene to another.
    
    Yesterday I received [2], which contains minor SPS changes where the
    profile and level do not change. These occur frequently and are not associated with
    scene changes. After 9519983c, the VT decoder session is recreated unnecessarily when
    these are encountered causing visual glitches.
    
    This commit simplifies the state kept in the VTContext to include just the first three
    bytes of the SPS, containing the profile and level details. This is populated initially
    when the VT decoder session is created, and used to detect changes and force a restart.
    
    This means minor SPS changes are fed directly into the existing decoder, whereas
    profile/level changes force the decoder session to be recreated with the new parameters.
    
    After this commit, both samples [1] and [2] playback as expected.
    
    [1] https://s3.amazonaws.com/tmm1/videotoolbox/spschange.ts
    [2] https://s3.amazonaws.com/tmm1/videotoolbox/spschange2.tsSigned-off-by: 's avatarAman Gupta <aman@tmm1.net>
    259dc4e0
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...