From 9283a4f19b762b25bc8e5e8f402fefb9097a1397 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 31 Oct 2017 15:15:27 +0100 Subject: [PATCH] avcodec/videotoolbox: fix opaque_ref handling This is a partial fix - to fix videotoolbox fully (with multithreaded hwaccel decoding), much more work would be required. Before this change, an assertion failure would trigger: $ ffmpeg -hwaccel videotoolbox -hwaccel_output_format videotoolbox_vld -i h264.ts -f null -y /dev/null Assertion (frame->private_ref && frame->private_ref->size == sizeof(FrameDecodeData)) || !(avctx->codec->capabilities & (1 << 1)) failed at libavcodec/decode.c:620 Signed-off-by: Aman Gupta --- libavcodec/videotoolbox.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index 4547ffef34d..9eeada30bae 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -27,6 +27,7 @@ #include "libavutil/avutil.h" #include "libavutil/hwcontext.h" #include "bytestream.h" +#include "decode.h" #include "h264dec.h" #include "hevcdec.h" #include "mpegvideo.h" @@ -70,6 +71,10 @@ static int videotoolbox_buffer_copy(VTContext *vtctx, int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, AVFrame *frame) { + int ret = ff_attach_decode_data(frame); + if (ret < 0) + return ret; + frame->width = avctx->width; frame->height = avctx->height; frame->format = avctx->pix_fmt; -- 2.39.2