]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/mpc8: get frame output buffer right before it is actually needed
authorPaul B Mahol <onemda@gmail.com>
Fri, 30 Mar 2018 10:34:05 +0000 (12:34 +0200)
committerPaul B Mahol <onemda@gmail.com>
Fri, 30 Mar 2018 10:52:54 +0000 (12:52 +0200)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavcodec/mpc8.c

index 6347e1f691dabf950c01b92c0040872fc2301950..3be2f79a5a1a79d20d52bbc29fc8699f61e4d145 100644 (file)
@@ -250,11 +250,6 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
     int maxband, keyframe;
     int last[2];
 
-    /* get output buffer */
-    frame->nb_samples = MPC_FRAME_SIZE;
-    if ((res = ff_get_buffer(avctx, frame, 0)) < 0)
-        return res;
-
     keyframe = c->cur_frame == 0;
 
     if(keyframe){
@@ -415,6 +410,10 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data,
         }
     }
 
+    frame->nb_samples = MPC_FRAME_SIZE;
+    if ((res = ff_get_buffer(avctx, frame, 0)) < 0)
+        return res;
+
     ff_mpc_dequantize_and_synth(c, maxband - 1,
                                 (int16_t **)frame->extended_data,
                                 avctx->channels);