[FFmpeg-cvslog] avcodec/videotoolbox: fix opaque_ref handling

wm4 git at videolan.org
Tue Nov 14 01:11:08 EET 2017


ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Tue Oct 31 15:15:27 2017 +0100| [9283a4f19b762b25bc8e5e8f402fefb9097a1397] | committer: Aman Gupta

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 <aman at tmm1.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9283a4f19b762b25bc8e5e8f402fefb9097a1397
---

 libavcodec/videotoolbox.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 4547ffef34..9eeada30ba 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;



More information about the ffmpeg-cvslog mailing list