From: Wenbinc-Bin <wenbin.c...@intel.com> Qsv decoder needs to call preinit() twice to get NumFrameSuggest to config init_pool_size. The hw_frame_ctx is released at the second time calling preinit(). The hw_frame_ctx is AVBufferRef, so it release the source when the last unref is called. When the old context is released, the new one is already created, and somehow the device memory is stil be taken, even if the destory memory function is called. Moving unref before creating new context can solve this problem.
Signed-off-by Wenbin Chen <wenbin.c...@intel.com> --- libavcodec/qsvdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index fba7d9cee6..23494c217d 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -179,6 +179,8 @@ static int qsv_decode_preinit(AVCodecContext *avctx, QSVContext *q, enum AVPixel pix_fmt, /* system memory format obtained from bitstream parser */ AV_PIX_FMT_NONE }; + av_buffer_unref(&q->frames_ctx.mids_buf); + av_buffer_unref(&q->frames_ctx.hw_frames_ctx); ret = ff_get_format(avctx, pix_fmts); if (ret < 0) { q->orig_pix_fmt = avctx->pix_fmt = AV_PIX_FMT_NONE; -- 2.25.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".