]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/alac.c
Cosmetic change aimed at making it easier to see how bits are consumed
[ffmpeg] / libavcodec / alac.c
index 6815fa1aea37cf3f4d0a0c4be73baa1727037f3b..1817161160817ace60fcf0bfd79cd0836b229fa4 100644 (file)
@@ -411,7 +411,7 @@ static int alac_decode_frame(AVCodecContext *avctx,
     int channels;
     unsigned int outputsamples;
     int hassize;
-    int readsamplesize;
+    unsigned int readsamplesize;
     int wasted_bytes;
     int isnotcompressed;
     uint8_t interlacing_shift;
@@ -476,6 +476,10 @@ static int alac_decode_frame(AVCodecContext *avctx,
 
     *outputsize = outputsamples * alac->bytespersample;
     readsamplesize = alac->setinfo_sample_size - (wasted_bytes * 8) + channels - 1;
+    if (readsamplesize > MIN_CACHE_BITS) {
+        av_log(avctx, AV_LOG_ERROR, "readsamplesize too big (%d)\n", readsamplesize);
+        return -1;
+    }
 
     if (!isnotcompressed) {
         /* so it is compressed */
@@ -594,6 +598,7 @@ static av_cold int alac_decode_init(AVCodecContext * avctx)
 
     alac->numchannels = alac->avctx->channels;
     alac->bytespersample = (avctx->bits_per_sample / 8) * alac->numchannels;
+    avctx->sample_fmt = SAMPLE_FMT_S16;
 
     return 0;
 }