diff options
author | Linjie Fu <linjie.fu@intel.com> | 2020-03-31 23:34:00 +0800 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2020-05-04 12:33:30 -0300 |
commit | 2b3206891649f317c20993411efef4bee39ae784 (patch) | |
tree | 04e8de81e09cc5853ca41bba3ca4d51f6ff6d46f /libavcodec/vaapi_encode_mpeg2.c | |
parent | 5767a2ed74078385a5ff70a7a487c1d4c367d729 (diff) | |
download | ffmpeg-2b3206891649f317c20993411efef4bee39ae784.tar.gz |
lavc/vaapi_encode: add FF_CODEC_CAP_INIT_CLEANUP caps for encoders
ff_vaapi_encode_close() is not enough to free the resources like cbs
if initialization failure happens after codec->configure (except for
vp8/vp9).
We need to call avctx->codec->close() to deallocate, otherwise memory
leak happens.
Add FF_CODEC_CAP_INIT_CLEANUP for vaapi encoders and deallocate the
resources at free_and_end inside avcodec_open2().
Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Diffstat (limited to 'libavcodec/vaapi_encode_mpeg2.c')
-rw-r--r-- | libavcodec/vaapi_encode_mpeg2.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c index 0398c4cd8c..02c76552ef 100644 --- a/libavcodec/vaapi_encode_mpeg2.c +++ b/libavcodec/vaapi_encode_mpeg2.c @@ -702,6 +702,7 @@ AVCodec ff_mpeg2_vaapi_encoder = { .close = &vaapi_encode_mpeg2_close, .priv_class = &vaapi_encode_mpeg2_class, .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, .defaults = vaapi_encode_mpeg2_defaults, .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_VAAPI, |