libopenh264dec: Simplify the init thanks to FF_CODEC_CAP_INIT_CLEANUP being set
authorMartin Storsjö <martin@martin.st>
Thu, 14 Jul 2016 19:20:25 +0000 (22:20 +0300)
committerMartin Storsjö <martin@martin.st>
Fri, 15 Jul 2016 10:36:21 +0000 (13:36 +0300)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/libopenh264dec.c

index a105fa52d963da98d6191b9fcd91779f22fb4542..cc18f240a6e32cbcb911f3b5521243e1adb084c4 100644 (file)
@@ -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)