Do not assume AV_SAMPLE_FMT_S16 as tta sample format.
authorCarl Eugen Hoyos <cehoyos@ag.or.at>
Mon, 2 May 2011 23:02:07 +0000 (01:02 +0200)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Mon, 2 May 2011 23:02:07 +0000 (01:02 +0200)
libavcodec/tta.c

index 3367788..217354c 100644 (file)
@@ -325,7 +325,7 @@ static int tta_decode_frame(AVCodecContext *avctx,
         int cur_chan = 0, framelen = s->frame_length;
         int32_t *p;
 
-        if (*data_size < (framelen * s->channels * 2)) {
+        if (*data_size < (framelen * s->channels * av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8)) {
             av_log(avctx, AV_LOG_ERROR, "Output buffer size is too small.\n");
             return -1;
         }