[FFmpeg-devel] [PATCH 2/2] lavf: clone the frame managed by framework.

Ruiling Song ruiling.song at intel.com
Wed Mar 21 09:43:18 EET 2018


we should clone the frame, which is managed by the framework.
directly assign it will cause double-free issue when qsv try
to free it. In fact, the frames was managed by the framework!

Right now, I am still not quite sure why we receive 'more data'
error from libmfx. But some simple debugging seems that it
is non-sense. so just skip it totally, not bothering to
return a EAGAIN error to the caller.

Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 libavfilter/qsvvpp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index f32b46d..980dd62 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -296,7 +296,7 @@ static QSVFrame *submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *p
             av_log(ctx, AV_LOG_ERROR, "QSVVPP gets a wrong frame.\n");
             return NULL;
         }
-        qsv_frame->frame   = picref;
+        qsv_frame->frame   = av_frame_clone(picref);
         qsv_frame->surface = (mfxFrameSurface1 *)qsv_frame->frame->data[3];
     } else {
         /* make a copy if the input is not padded as libmfx requires */
@@ -318,7 +318,7 @@ static QSVFrame *submit_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *p
             av_frame_copy_props(qsv_frame->frame, picref);
             av_frame_free(&picref);
         } else
-            qsv_frame->frame = picref;
+            qsv_frame->frame = av_frame_clone(picref);
 
         if (map_frame_to_surface(qsv_frame->frame,
                                 &qsv_frame->surface_internal) < 0) {
@@ -707,7 +707,7 @@ int ff_qsvvpp_filter_frame(QSVVPPContext *s, AVFilterLink *inlink, AVFrame *picr
         if (ret < 0 && ret != MFX_ERR_MORE_SURFACE) {
             /* Ignore more_data error */
             if (ret == MFX_ERR_MORE_DATA)
-                ret = AVERROR(EAGAIN);
+                ret = 0;
             break;
         }
 
-- 
2.7.4



More information about the ffmpeg-devel mailing list