vda: fix crash when a frame is dropped.
authorXidorn Quan <quanxunzhen@gmail.com>
Mon, 27 Jan 2014 19:35:23 +0000 (20:35 +0100)
committerSebastien Zwickert <dilaroga@gmail.com>
Mon, 27 Jan 2014 19:36:42 +0000 (20:36 +0100)
Signed-off-by: Sebastien Zwickert <dilaroga@gmail.com>
libavcodec/vda.h
libavcodec/vda_h264.c

index b3d6399..2f68188 100644 (file)
 
 #include "libavcodec/version.h"
 
+// extra flags not defined in VDADecoder.h
+enum {
+    kVDADecodeInfo_Asynchronous = 1UL << 0,
+    kVDADecodeInfo_FrameDropped = 1UL << 1
+};
+
 /**
  * @defgroup lavc_codec_hwaccel_vda VDA
  * @ingroup lavc_codec_hwaccel
index e0561e2..1eff671 100644 (file)
@@ -41,6 +41,9 @@ static void vda_decoder_callback(void *vda_hw_ctx,
 {
     struct vda_context *vda_ctx = vda_hw_ctx;
 
+    if (infoFlags & kVDADecodeInfo_FrameDropped)
+        vda_ctx->cv_buffer = NULL;
+
     if (!image_buffer)
         return;