[FFmpeg-devel] [PATCH 2/5] avcodec/libsvtav1: remove unneeded svt_av1_enc_deinit_handle()
James Almer
jamrial at gmail.com
Sat Aug 1 16:09:20 EEST 2020
On 8/1/2020 8:22 AM, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
> libavcodec/libsvtav1.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
> index d34c6b3..eb6043b 100644
> --- a/libavcodec/libsvtav1.c
> +++ b/libavcodec/libsvtav1.c
> @@ -273,23 +273,17 @@ static av_cold int eb_enc_init(AVCodecContext *avctx)
>
> ret = config_enc_params(&svt_enc->enc_params, avctx);
> if (ret < 0) {
> - svt_av1_enc_deinit_handle(svt_enc->svt_handle);
> - svt_enc->svt_handle = NULL;
> av_log(avctx, AV_LOG_ERROR, "Error configuring encoder parameters\n");
> return ret;
> }
>
> svt_ret = svt_av1_enc_set_parameter(svt_enc->svt_handle, &svt_enc->enc_params);
> if (svt_ret != EB_ErrorNone) {
> - svt_av1_enc_deinit_handle(svt_enc->svt_handle);
> - svt_enc->svt_handle = NULL;
> return svt_print_error(avctx, svt_ret, "Error setting encoder parameters");
> }
>
> svt_ret = svt_av1_enc_init(svt_enc->svt_handle);
> if (svt_ret != EB_ErrorNone) {
> - svt_av1_enc_deinit_handle(svt_enc->svt_handle);
> - svt_enc->svt_handle = NULL;
> return svt_print_error(avctx, svt_ret, "Error initializing encoder");
> }
Did you try to trigger one of these paths without the code you're
removing? Afaik these were added because otherwise the library would
segfault during close(), because svt_av1_enc_deinit() was called on it
on an scenario where svt_av1_enc_init() hadn't ever been called.
A proper change would be to ensure the above doesn't happen.
More information about the ffmpeg-devel
mailing list