avcodec/videotoolbox: use decode_params to propagate H264 PPS changes and restart...
authorAman Gupta <aman@tmm1.net>
Fri, 10 Nov 2017 20:25:39 +0000 (12:25 -0800)
committerAman Gupta <aman@tmm1.net>
Mon, 13 Nov 2017 22:32:48 +0000 (14:32 -0800)
commit9519983c0f39d01fd86544dc56adbbf15bdd3c3c
tree626c230412f199e7ebdbd2f2df90048cd5f925bc
parent872add08540fb36b2d2ca75df86da7d8ac9579a1
avcodec/videotoolbox: use decode_params to propagate H264 PPS changes and restart on SPS changes

This fixes decoding of H264 video samples with SPS and PPS changes.

See for example https://s3.amazonaws.com/tmm1/videotoolbox/spschange.ts,
which previously stalled the decoder and failed to produce any new frames
after the SPS change.

Also see https://s3.amazonaws.com/tmm1/videotoolbox/ppschange.ts, which
uses multiple PPS and would previously cause VT decode failures.

If the VideoToolbox session needs to be restarted, and
videotoolbox_start() fails for some reason (for instance, if the video
is interlaced and the decoder is running on iOS), avcodec will return
AVERROR_EXTERNAL. This can be used by the API user to switch to another
decoder.

Signed-off-by: Aman Gupta <aman@tmm1.net>
libavcodec/videotoolbox.c
libavcodec/vt_internal.h