diff mbox series

[FFmpeg-devel,3/3] avcodec/h264dec: Add FF_CODEC_CAP_INIT_CLEANUP

Message ID 1589800269-30359-3-git-send-email-lance.lmwang@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,1/3] avcodec/adpcmenc: Add FF_CODEC_CAP_INIT_CLEANUP
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Limin Wang May 18, 2020, 11:11 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

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.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/h264dec.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 4c355fe..3478b38 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -226,7 +226,6 @@  int ff_h264_alloc_tables(H264Context *h)
     return 0;
 
 fail:
-    ff_h264_free_tables(h);
     return AVERROR(ENOMEM);
 }
 
@@ -418,7 +417,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;
@@ -1036,7 +1034,7 @@  AVCodec ff_h264_decoder = {
     .decode                = h264_decode_frame,
     .capabilities          = /*AV_CODEC_CAP_DRAW_HORIZ_BAND |*/ AV_CODEC_CAP_DR1 |
                              AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
-                             AV_CODEC_CAP_FRAME_THREADS,
+                             AV_CODEC_CAP_FRAME_THREADS | FF_CODEC_CAP_INIT_CLEANUP,
     .hw_configs            = (const AVCodecHWConfigInternal*[]) {
 #if CONFIG_H264_DXVA2_HWACCEL
                                HWACCEL_DXVA2(h264),