diff options
author | wm4 <nfxjfg@googlemail.com> | 2015-11-20 11:30:18 +0100 |
---|---|---|
committer | wm4 <nfxjfg@googlemail.com> | 2015-11-20 11:30:18 +0100 |
commit | 9747219958060d8c4f697df62e7f172c2a77e6c7 (patch) | |
tree | 8f9a3a48aac29fc0521cf5d46e8dfdfa59aeca68 /libavcodec/videotoolbox.c | |
parent | 8eadabf941a908101c69706063415d4ab6a630da (diff) | |
download | ffmpeg-9747219958060d8c4f697df62e7f172c2a77e6c7.tar.gz |
avcodec/h264, videotoolbox: do not return invalid frames on failure
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).
Diffstat (limited to 'libavcodec/videotoolbox.c')
-rw-r--r-- | libavcodec/videotoolbox.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index cc1e592ac9..2f4d531601 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -353,6 +353,8 @@ static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame) AVVideotoolboxContext *videotoolbox = avctx->hwaccel_context; VTContext *vtctx = avctx->internal->hwaccel_priv_data; + av_buffer_unref(&frame->buf[0]); + if (!videotoolbox->session || !vtctx->bitstream) return AVERROR_INVALIDDATA; |