summaryrefslogtreecommitdiff
path: root/libavcodec/mpegaudiodec_template.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2020-08-03 10:40:10 -0300
committerJames Almer <jamrial@gmail.com>2020-08-03 11:09:47 -0300
commit08f60a35b452967091aec8426f97c502226090e2 (patch)
treea78c30a06410df2175999f6e0b03aa2af69eb7fc /libavcodec/mpegaudiodec_template.c
parent9afd1f6ff2652daefd134350171f35f97c3e069b (diff)
avcodec/mpegaudiodec_template: disable CRC checking for layers 1 and 2
Layers 1 and 2 use lengths in bits which are not a multiple of 8, and our CRC works on a per-byte basis. Based on b48397e7b8 Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/mpegaudiodec_template.c')
-rw-r--r--libavcodec/mpegaudiodec_template.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
index 3d7e3ba4f2..3ae73d3c8d 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -1568,7 +1568,7 @@ static int mp_decode_frame(MPADecodeContext *s, OUT_INT **samples,
if (s->error_protection) {
uint16_t crc = get_bits(&s->gb, 16);
- if (s->err_recognition & AV_EF_CRCCHECK) {
+ if (s->err_recognition & AV_EF_CRCCHECK && s->layer == 3) {
const int sec_len = s->lsf ? ((s->nb_channels == 1) ? 9 : 17) :
((s->nb_channels == 1) ? 17 : 32);
const AVCRC *crc_tab = av_crc_get_table(AV_CRC_16_ANSI);