diff mbox series

[FFmpeg-devel,2/2] avcodec/zerocodec: use init cleanup internal cap

Message ID 20200409085053.26045-2-onemda@gmail.com
State Accepted
Commit 932493f9c2a8cd9c79878694a26a0521114b59a4
Headers show
Series [FFmpeg-devel,1/2] avcodec/zerocodec: implement flushing
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Paul B Mahol April 9, 2020, 8:50 a.m. UTC
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/zerocodec.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Vittorio Giovara April 11, 2020, 6:18 a.m. UTC | #1
On Thu, Apr 9, 2020 at 5:21 AM Paul B Mahol <onemda@gmail.com> wrote:

> Signed-off-by: Paul B Mahol <onemda@gmail.com>
> ---
>  libavcodec/zerocodec.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c
> index b0fab91004..1051fdaa45 100644
> --- a/libavcodec/zerocodec.c
> +++ b/libavcodec/zerocodec.c
> @@ -131,10 +131,8 @@ static av_cold int
> zerocodec_decode_init(AVCodecContext *avctx)
>      }
>
>      zc->previous_frame = av_frame_alloc();
> -    if (!zc->previous_frame) {
> -        zerocodec_decode_close(avctx);
> +    if (!zc->previous_frame)
>          return AVERROR(ENOMEM);
> -    }
>
>      return 0;
>  }
> @@ -157,5 +155,6 @@ AVCodec ff_zerocodec_decoder = {
>      .flush          = zerocodec_decode_flush,
>      .close          = zerocodec_decode_close,
>      .capabilities   = AV_CODEC_CAP_DR1,
> -    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
> +    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE |
> +                      FF_CODEC_CAP_INIT_CLEANUP,
>  };
> --
> 2.17.1
>

seems good to me, I'd keep the {} for clarity as minor nit
diff mbox series

Patch

diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c
index b0fab91004..1051fdaa45 100644
--- a/libavcodec/zerocodec.c
+++ b/libavcodec/zerocodec.c
@@ -131,10 +131,8 @@  static av_cold int zerocodec_decode_init(AVCodecContext *avctx)
     }
 
     zc->previous_frame = av_frame_alloc();
-    if (!zc->previous_frame) {
-        zerocodec_decode_close(avctx);
+    if (!zc->previous_frame)
         return AVERROR(ENOMEM);
-    }
 
     return 0;
 }
@@ -157,5 +155,6 @@  AVCodec ff_zerocodec_decoder = {
     .flush          = zerocodec_decode_flush,
     .close          = zerocodec_decode_close,
     .capabilities   = AV_CODEC_CAP_DR1,
-    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+    .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE |
+                      FF_CODEC_CAP_INIT_CLEANUP,
 };