summaryrefslogtreecommitdiff
path: root/libavcodec/vt_internal.h
Commit message (Collapse)AuthorAge
* lavc/videotoolbox: fix threaded decodingRodger Combs2018-03-08
| | | | | | | | | | | | | | | | | | AVHWAccel.end_frame can run on a worker thread. The assumption of the frame threading code is that the worker thread will change the AVFrame image data, not the AVFrame fields. So the AVFrame fields are not synced back to the main thread. But this breaks videotoolbox due to its special requirements (everything else is fine). It actually wants to update AVFrame fields. The actual videotoolbox frame is now stored in the dummy AVBufferRef, so it mimics what happens in non-videotoolbox cases. (Changing the AVBufferRef contents is a bit like changing the image data.) The post_process callback copies that reference to the proper AVFrame field. Based on a patch by wm4. Signed-off-by: Aman Gupta <aman@tmm1.net>
* libavcodec/videotoolbox: fix decoding of h264 streams with minor SPS changesAman Gupta2017-11-20
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.ts Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/videotoolbox: use decode_params to propagate H264 PPS changes and ↵Aman Gupta2017-11-13
| | | | | | | | | | | | | | | | | | | | | 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>
* lavc: drop VDAClément Bœsch2017-10-23
Deprecated (aka removed) in OSX 10.11, and we have a replacement for it (VideoToolbox).