[2/4] libopenh264dec: Simplify the init thanks to FF_CODEC_CAP_INIT_CLEANUP being set

Message ID 1468525196-59168-2-git-send-email-martin@martin.st
State Committed
Commit 36b380dcd52ef47d7ba0559ed51192c88d82a9bd
Headers show

Commit Message

Martin Storsjö July 14, 2016, 7:39 p.m.
---
 libavcodec/libopenh264dec.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

Comments

Luca Barbato July 14, 2016, 7:52 p.m. | #1
On 14/07/16 21:39, Martin Storsjö wrote:
> ---
>  libavcodec/libopenh264dec.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 

Seems ok.

Patch

diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c
index a105fa5..cc18f24 100644
--- a/libavcodec/libopenh264dec.c
+++ b/libavcodec/libopenh264dec.c
@@ -72,15 +72,12 @@  static av_cold int svc_decode_init(AVCodecContext *avctx)
         return err;
 
     s->packet_fifo = av_fifo_alloc(sizeof(AVPacket));
-    if (!s->packet_fifo) {
-        err = AVERROR(ENOMEM);
-        goto fail;
-    }
+    if (!s->packet_fifo)
+        return AVERROR(ENOMEM);
 
     if (WelsCreateDecoder(&s->decoder)) {
         av_log(avctx, AV_LOG_ERROR, "Unable to create decoder\n");
-        err = AVERROR_UNKNOWN;
-        goto fail;
+        return AVERROR_UNKNOWN;
     }
 
     // Pass all libopenh264 messages to our callback, to allow ourselves to filter them.
@@ -98,14 +95,12 @@  static av_cold int svc_decode_init(AVCodecContext *avctx)
 
     if ((*s->decoder)->Initialize(s->decoder, &param) != cmResultSuccess) {
         av_log(avctx, AV_LOG_ERROR, "Initialize failed\n");
-        err = AVERROR_UNKNOWN;
-        goto fail;
+        return AVERROR_UNKNOWN;
     }
 
     avctx->pix_fmt = AV_PIX_FMT_YUV420P;
 
-fail:
-    return err;
+    return 0;
 }
 
 static int init_bsf(AVCodecContext *avctx)