1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/h264dec: Add FF_CODEC_CAP_INIT_CLEANUP

then ff_h264_free_tables() and h264_decode_end() can be removed
in h264_decode_init() if it's failed.

The FF_CODEC_CAP_INIT_CLEANUP flag is need for single thread, For multithread,
it'll be cleanup still by AV_CODEC_CAP_FRAME_THREADS flag if have.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
Limin Wang 2020-05-27 12:35:28 +08:00
parent 467d9e27e0
commit b01d12bcc0

View File

@ -228,7 +228,6 @@ int ff_h264_alloc_tables(H264Context *h)
return 0; return 0;
fail: fail:
ff_h264_free_tables(h);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
@ -420,7 +419,6 @@ static av_cold int h264_decode_init(AVCodecContext *avctx)
av_log(avctx, explode ? AV_LOG_ERROR: AV_LOG_WARNING, av_log(avctx, explode ? AV_LOG_ERROR: AV_LOG_WARNING,
"Error decoding the extradata\n"); "Error decoding the extradata\n");
if (explode) { if (explode) {
h264_decode_end(avctx);
return ret; return ret;
} }
ret = 0; ret = 0;
@ -1107,7 +1105,7 @@ AVCodec ff_h264_decoder = {
NULL NULL
}, },
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_EXPORTS_CROPPING | .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_EXPORTS_CROPPING |
FF_CODEC_CAP_ALLOCATE_PROGRESS, FF_CODEC_CAP_ALLOCATE_PROGRESS | FF_CODEC_CAP_INIT_CLEANUP,
.flush = h264_decode_flush, .flush = h264_decode_flush,
.update_thread_context = ONLY_IF_THREADS_ENABLED(ff_h264_update_thread_context), .update_thread_context = ONLY_IF_THREADS_ENABLED(ff_h264_update_thread_context),
.profiles = NULL_IF_CONFIG_SMALL(ff_h264_profiles), .profiles = NULL_IF_CONFIG_SMALL(ff_h264_profiles),