History

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().

Linjie Fu committed 6 years ago

Commit 2b320681 parent 5767a2e7 files · +6 −1Browse files

Showing the changes to libavcodec/vaapi_encode_mpeg2.c (1 of 7 files). Show all

Unified · Split

libavcodec/vaapi_encode_mpeg2.c+1−0
@@ -702,6 +702,7 @@ AVCodec ff_mpeg2_vaapi_encoder = { · 701 unmodified lines
702 .close = &vaapi_encode_mpeg2_close,702 .close = &vaapi_encode_mpeg2_close,
703 .priv_class = &vaapi_encode_mpeg2_class,703 .priv_class = &vaapi_encode_mpeg2_class,
704 .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE,704 .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE,
705 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
705 .defaults = vaapi_encode_mpeg2_defaults,706 .defaults = vaapi_encode_mpeg2_defaults,
706 .pix_fmts = (const enum AVPixelFormat[]) {707 .pix_fmts = (const enum AVPixelFormat[]) {
707 AV_PIX_FMT_VAAPI,708 AV_PIX_FMT_VAAPI,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t