summaryrefslogtreecommitdiff
path: root/libavcodec/h264dec.c
diff options
context:
space:
mode:
authorLimin Wang <lance.lmwang@gmail.com>2020-05-27 12:35:28 +0800
committerLimin Wang <lance.lmwang@gmail.com>2020-05-27 21:59:51 +0800
commitb01d12bcc0fcebb2b5f06296d7a5c140cb30655b (patch)
tree0937ff6aab4bb1cf9cf58a2c8c4d791c4c48a138 /libavcodec/h264dec.c
parent467d9e27e0cb2bf74f41dc832f2f8d191ba58ec9 (diff)
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>
Diffstat (limited to 'libavcodec/h264dec.c')
-rw-r--r--libavcodec/h264dec.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 47d7cbf158..e463fde2a5 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -228,7 +228,6 @@ int ff_h264_alloc_tables(H264Context *h)
return 0;
fail:
- ff_h264_free_tables(h);
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,
"Error decoding the extradata\n");
if (explode) {
- h264_decode_end(avctx);
return ret;
}
ret = 0;
@@ -1107,7 +1105,7 @@ AVCodec ff_h264_decoder = {
NULL
},
.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,
.update_thread_context = ONLY_IF_THREADS_ENABLED(ff_h264_update_thread_context),
.profiles = NULL_IF_CONFIG_SMALL(ff_h264_profiles),