[FFmpeg-devel] [PATCH] vda: fix crash when a frame is dropped.

Sebastien Zwickert dilaroga at gmail.com
Tue Jan 21 09:35:44 CET 2014


From: Xidorn Quan <quanxunzhen at gmail.com>

---
 libavcodec/vda.h      | 6 ++++++
 libavcodec/vda_h264.c | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/libavcodec/vda.h b/libavcodec/vda.h
index b3d6399..2f68188 100644
--- a/libavcodec/vda.h
+++ b/libavcodec/vda.h
@@ -41,6 +41,12 @@
 
 #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
diff --git a/libavcodec/vda_h264.c b/libavcodec/vda_h264.c
index e0561e2..1eff671 100644
--- a/libavcodec/vda_h264.c
+++ b/libavcodec/vda_h264.c
@@ -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;
 
-- 
1.8.3.4 (Apple Git-47)



More information about the ffmpeg-devel mailing list