Skip to content
Snippets Groups Projects
Commit 1d5b35cc authored by James Almer's avatar James Almer Committed by Paul B Mahol
Browse files

lavc/flacdec: Add frame CRC calculation


Fixes ticket #2266

Signed-off-by: default avatarJames Almer <jamrial@gmail.com>
parent 4ae74c63
Branches
Tags
No related merge requests found
...@@ -533,7 +533,15 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data, ...@@ -533,7 +533,15 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data,
av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n"); av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n");
return -1; 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 */ /* get output buffer */
frame->nb_samples = s->blocksize; frame->nb_samples = s->blocksize;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment