comparison atrac3.c @ 12380:e402b74c4b62 libavcodec

Fix handling of truncated files. Should fix random FATE breakages.
author vitor
date Mon, 09 Aug 2010 07:17:01 +0000
parents d66dc6f9cc55
children
comparison
equal deleted inserted replaced
12379:2ea2fd28da07 12380:e402b74c4b62
825 ATRAC3Context *q = avctx->priv_data; 825 ATRAC3Context *q = avctx->priv_data;
826 int result = 0, i; 826 int result = 0, i;
827 const uint8_t* databuf; 827 const uint8_t* databuf;
828 int16_t* samples = data; 828 int16_t* samples = data;
829 829
830 if (buf_size < avctx->block_align) 830 if (buf_size < avctx->block_align) {
831 av_log(avctx, AV_LOG_ERROR,
832 "Frame too small (%d bytes). Truncated file?\n", buf_size);
833 *data_size = 0;
831 return buf_size; 834 return buf_size;
835 }
832 836
833 /* Check if we need to descramble and what buffer to pass on. */ 837 /* Check if we need to descramble and what buffer to pass on. */
834 if (q->scrambled_stream) { 838 if (q->scrambled_stream) {
835 decode_bytes(buf, q->decoded_bytes_buffer, avctx->block_align); 839 decode_bytes(buf, q->decoded_bytes_buffer, avctx->block_align);
836 databuf = q->decoded_bytes_buffer; 840 databuf = q->decoded_bytes_buffer;