]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/adpcm: init from extradata before setting sample formats
authorZane van Iperen <zane@zanevaniperen.com>
Sun, 25 Apr 2021 01:27:41 +0000 (11:27 +1000)
committerZane van Iperen <zane@zanevaniperen.com>
Sun, 25 Apr 2021 11:32:26 +0000 (21:32 +1000)
Fixes a crash when decoding VQA files.

Regression since c012f9b265e172de9c240c9dfab8665936fa3e83.

Reported-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
libavcodec/adpcm.c

index be14607eacdf9eb98ebcd53d5c6b2162d0a4b724..b031e24981727c622db669a2114f81ee4ab1044f 100644 (file)
@@ -111,6 +111,8 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
     unsigned int min_channels = 1;
     unsigned int max_channels = 2;
 
+    adpcm_flush(avctx);
+
     switch(avctx->codec->id) {
     case AV_CODEC_ID_ADPCM_IMA_AMV:
         max_channels = 1;
@@ -201,8 +203,6 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx)
     default:
         avctx->sample_fmt = AV_SAMPLE_FMT_S16;
     }
-
-    adpcm_flush(avctx);
     return 0;
 }