Browse Source

lavc/flacdec: Add frame CRC calculation

Fixes ticket #2266

Signed-off-by: James Almer <jamrial@gmail.com>
tags/n1.2
James Almer Paul B Mahol 12 years ago
parent
commit
1d5b35cc07
1 changed files with 9 additions and 1 deletions
  1. +9
    -1
      libavcodec/flacdec.c

+ 9
- 1
libavcodec/flacdec.c View File

@@ -533,7 +533,15 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n");
return -1;
}
bytes_read = (get_bits_count(&s->gb)+7)/8;
bytes_read = get_bits_count(&s->gb)/8;

if ((s->avctx->err_recognition & AV_EF_CRCCHECK) &&
av_crc(av_crc_get_table(AV_CRC_16_ANSI),
0, buf, bytes_read)) {
av_log(s->avctx, AV_LOG_ERROR, "CRC error at PTS %"PRId64"\n", avpkt->pts);
if (s->avctx->err_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA;
}

/* get output buffer */
frame->nb_samples = s->blocksize;


Loading…
Cancel
Save