summaryrefslogtreecommitdiff
path: root/libavcodec/videotoolbox.c
Commit message (Collapse)AuthorAgeFilesLines
...
* avcodec/h264, videotoolbox: fix crash after VT decoder failsAman Gupta2017-03-071-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The way videotoolbox hooks in as a hwaccel is pretty hacky. The VT decode API is not invoked until end_frame(), so alloc_frame() returns a dummy frame with a 1-byte buffer. When end_frame() is eventually called, the dummy buffer is replaced with the actual decoded data from VTDecompressionSessionDecodeFrame(). When the VT decoder fails, the frame returned to the h264 decoder from alloc_frame() remains invalid and should not be used. Before 9747219958060d8c4f697df62e7f172c2a77e6c7, it was accidentally being returned all the way up to the API user. After that commit, the dummy frame was unref'd so the user received an error. However, since that commit, VT hwaccel failures started causing random segfaults in the h264 decoder. This happened more often on iOS where the VT implementation is more likely to throw errors on bitstream anomolies. A recent report of this issue can be see in http://ffmpeg.org/pipermail/libav-user/2016-November/009831.html The issue here is that the dummy frame is still referenced internally by the h264 decoder, as part of the reflist and cur_pic_ptr. Deallocating the frame causes assertions like this one to trip later on during decoding: Assertion h->cur_pic_ptr->f->buf[0] failed at src/libavcodec/h264_slice.c:1340 With this commit, we leave the dummy 1-byte frame intact, but avoid returning it to the user. This reverts commit 9747219958060d8c4f697df62e7f172c2a77e6c7. Signed-off-by: wm4 <nfxjfg@googlemail.com>
* avcodec/videotoolbox: set kCVPixelBufferOpenGLESCompatibilityKey for iOSwang-bin2017-03-061-0/+5
| | | | | kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey is not available in iOS
* avcodec/videotoolbox: set kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKeywm42017-03-021-0/+1
| | | | | Makes sure the output can be mapped as OpenGL texture. This is what at least video players normally want.
* avcodec/videotoolbox: allow not setting the kCVPixelBufferPixelFormatTypeKeywm42017-03-021-1/+2
| | | | | | | | | | | If AVVideotoolboxContext.cv_pix_fmt_type is set to 0, don't set the kCVPixelBufferPixelFormatTypeKey value on the VT decoder. This makes VT output its native format, which can be much faster on some hardware iterations (if the native format does not match with the requested format, it will be converted, which is slow). The default is still forcing nv12.
* Merge commit '9df889a5f116c1ee78c2f239e0ba599c492431aa'Clément Bœsch2016-07-291-1/+1
| | | | | | | * commit '9df889a5f116c1ee78c2f239e0ba599c492431aa': h264: rename h264.[ch] to h264dec.[ch] Merged-by: Clément Bœsch <u@pkh.me>
* lavc/videotoolbox: fix avcC extradata creationMatthieu Bouron2016-06-221-60/+22
| | | | | | | | | | Fixes properly ticket #5638. Since 772ad7142dff590c7bb30370acf5d3c9a8fb512b PPS and SPS contain the nal type byte. This reverts commit b8d754c5d0a2e99022c27bd1159ea3f597f67452. This reverts commit 8e47a99f576da10b2a36e33b6b9acbf1c2da7485.
* lavc/videotoolbox: Fix videotoolbox compile error on OS X 10.8.Dan Dennedy2016-06-191-0/+5
| | | | | | | | | Fixes error: libavcodec/videotoolbox.c:511:18: error: implicit declaration of function 'CMVideoFormatDescriptionCreateFromH264ParameterSets' is invalid in C99 This was added in 10.9: https://developer.apple.com/reference/coremedia/1489818-cmvideoformatdescriptioncreatefr?language=objc
* lavc/videotoolbox: remove config_info maximum capacityClément Bœsch2016-06-171-1/+1
| | | | | In case of extradata, config_info will contain two entries instead of one.
* lavc/videotoolbox: CFRelease() sessionClément Bœsch2016-06-171-1/+3
| | | | | | "When you are done with a decompression session you created, call VTDecompressionSessionInvalidate to tear it down and then CFRelease to release your object reference."
* lavc/videotoolbox: fix H.264 hwaccel init issueRick Kern2016-06-161-14/+45
| | | | | | Fixes VTDecompressionSessionCreate() error. Signed-off-by: Rick Kern <kernrj@gmail.com>
* lavc/videotoolbox: fix sps/pps mistake introduced in 1534ef87Clément Bœsch2016-06-121-1/+1
|
* lavc/videotoolbox: fixes compilation after 1534ef87Clément Bœsch2016-06-121-3/+3
|
* Merge commit '3176217c60ca7828712985092d9102d331ea4f3d'Clément Bœsch2016-06-121-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '3176217c60ca7828712985092d9102d331ea4f3d': h264: decouple h264_ps from the h264 decoder Main changes: - a local GetBitContext is created for the various ff_h264_decode_seq_parameter_set() attempts - just like the old code, remove_sps() is adjusted so it doesn't remove the pps. Fixes decode with Ticket #631 http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20111108/dae58f17/attachment.mp4 but see next point as well. - ff_h264_update_thread_context() is updated to work even when SPS isn't set as it breaks current skip_frame code. This makes sure we can still decode the sample from ticket #631 without the need for -flags2 +chunks. (Thanks to Michael) - keep {sps,pps}_ref pointers that stay alive even when the active pps/sps get removed from the available lists (patch by michaelni with additionnal frees in ff_h264_free_context() from mateo) - added a check on sps in avpriv_h264_has_num_reorder_frames() to fix crashes with mpegts_with_dvbsubs.ts from Ticket #4074 http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket4074/mpegts_with_dvbsubs.ts - in h264_parser.c:h264_parse(), after the ff_h264_decode_extradata() is called, the pps and sps from the local parser context are updated with the pps and sps from the used h264context. This fixes fate-flv-demux. - in h264_slice.c, "PPS changed between slices" error is not triggered anymore in one condition as it makes fate-h264-xavc-4389 fails with THREADS=N (Thanks to Michael) Merged-by: Clément Bœsch <clement@stupeflix.com> Merged-by: Michael Niedermayer <michael@niedermayer.cc> Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
* avcodec/h264, videotoolbox: do not return invalid frames on failurewm42015-11-201-0/+2
| | | | | | | | | | | | If videotoolbox_common_end_frame failed, then the AVFrame was returned to the API user with the dummy buffer (in AVFrame.buf[0]) still set, and the decode call indicating success. These "half-set" AVFrames with dummy buffer are a videotoolbox specific hack, because the decoder requires an allocated AVFrame for its internal logic. Videotoolbox on the other hand allocates its frame itself internally, and outputs it only on end_frame. At this point, the dummy buffer is replaced with the real frame (unless decoding fails).
* avcodec/videotoolbox: fix decoding of some h264 bitstreamswm42015-10-021-18/+30
| | | | | | | | | | | | | | | This affects Annex B streams (such as demuxed from .ts and others). It also handles the format change in reinit-large_420_8-to-small_420_8.h264 correctly. Instead of passing through the extradata, create it on the fly it from the currently active SPS and PPS. Since reconstructing the PPS and SPS NALs would be very complicated and verbose, we use the NALs as they originally appeared in the bitstream. The code for writing the extradata is somewhat derived from libavformat/avc.c, but it's small and different enough that sharing it is not really worth it.
* videotoolbox: require hardware accelerationStefano Pigozzi2015-09-291-3/+3
| | | | | | | | | VideoToolbox also implements a software decoder for h264, and will fallback to using it if the file cannot be decoded on the GPU. In these cases though, we want the hwaccel to fail so that we can use the libavcodec software decoder instead of the Apple one. Signed-off-by: wm4 <nfxjfg@googlemail.com>
* avcodec/videotoolbox: fix -Wunused-but-set-variableGanesh Ajjanagadde2015-09-291-3/+0
| | | | | | | | | | | | pix_fmt was declared presumably to shorten the argument passed to the function. However, it is currently not being used for such a purpose. This patch simply removes it instead. This fixes -Wunused-but-set-variable reported at e.g: http://fate.ffmpeg.org/log.cgi?time=20150919194249&log=compile&slot=x86_64-darwin-gcc-4.9. Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com> Reviewed-by: wm4 <nfxjfg@googlemail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/videotoolbox: Add missing AV_ prefix to CODEC_ID in commentMichael Niedermayer2015-08-031-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/videotoolbox: Fix bistream typoMichael Niedermayer2015-08-031-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: add new Videotoolbox hwaccel.Sebastien Zwickert2015-08-031-0/+690