aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/qsvvpp.c
diff options
context:
space:
mode:
authorRuiling Song <ruiling.song@intel.com>2018-04-03 09:50:20 +0800
committerMark Thompson <sw@jkqxz.net>2018-04-21 19:00:43 +0100
commitd865783b6c8d4f96f5094ed72eff0f5a4a4908af (patch)
treedd27be107794f95b5fd12fd09e80c57087e460e5 /libavfilter/qsvvpp.c
parentf3341a0452419c57faf4d28aebb24be5d41312f3 (diff)
downloadffmpeg-d865783b6c8d4f96f5094ed72eff0f5a4a4908af.tar.gz
lavf/qsv: clone the frame which may be managed by framework
For filters based on framesync, the input frame was managed by framesync, so we should not directly keep and destroy it, instead we make a clone of it here, or else double-free will occur. But for other filters not based on framesync, we still need to free the input frame inside filter_frame. Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Diffstat (limited to 'libavfilter/qsvvpp.c')
-rw-r--r--libavfilter/qsvvpp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index 732cf56a6a..2c01295628 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) {