]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ra144dec.c
hevc_filter: drop redundant checks
[ffmpeg] / libavcodec / ra144dec.c
index e2d116c20174bdc2b0e235bff98325d6325389a7..3be3877f313215f880d2e70da29386f22535c6f9 100644 (file)
@@ -76,6 +76,13 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data,
     RA144Context *ractx = avctx->priv_data;
     GetBitContext gb;
 
+    if (buf_size < FRAMESIZE) {
+        av_log(avctx, AV_LOG_ERROR,
+               "Frame too small (%d bytes). Truncated file?\n", buf_size);
+        *got_frame_ptr = 0;
+        return AVERROR_INVALIDDATA;
+    }
+
     /* get output buffer */
     frame->nb_samples = NBLOCKS * BLOCKSIZE;
     if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
@@ -84,12 +91,6 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data,
     }
     samples = (int16_t *)frame->data[0];
 
-    if(buf_size < FRAMESIZE) {
-        av_log(avctx, AV_LOG_ERROR,
-               "Frame too small (%d bytes). Truncated file?\n", buf_size);
-        *got_frame_ptr = 0;
-        return buf_size;
-    }
     init_get_bits(&gb, buf, FRAMESIZE * 8);
 
     for (i = 0; i < LPC_ORDER; i++)
@@ -128,11 +129,11 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data,
 
 AVCodec ff_ra_144_decoder = {
     .name           = "real_144",
+    .long_name      = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
     .type           = AVMEDIA_TYPE_AUDIO,
     .id             = AV_CODEC_ID_RA_144,
     .priv_data_size = sizeof(RA144Context),
     .init           = ra144_decode_init,
     .decode         = ra144_decode_frame,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name      = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
 };