diff mbox series

[FFmpeg-devel] avcodec/mpegaudiodec_template: disable CRC checking for layers 1 and 2

Message ID 20200803134311.4759-1-jamrial@gmail.com
State Accepted
Commit 08f60a35b452967091aec8426f97c502226090e2
Headers show
Series [FFmpeg-devel] avcodec/mpegaudiodec_template: disable CRC checking for layers 1 and 2
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

James Almer Aug. 3, 2020, 1:43 p.m. UTC
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

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/mpegaudiodec_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lynne Aug. 3, 2020, 1:45 p.m. UTC | #1
Aug 3, 2020, 15:43 by jamrial@gmail.com:

> 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
>

LGTM, that was a really bad messup on my part.
Thanks.
James Almer Aug. 3, 2020, 1:46 p.m. UTC | #2
On 8/3/2020 10:45 AM, Lynne wrote:
> Aug 3, 2020, 15:43 by jamrial@gmail.com:
> 
>> 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
>>
> 
> LGTM, that was a really bad messup on my part.
> Thanks.

Will apply. Thanks.
Michael Niedermayer Aug. 3, 2020, 4:19 p.m. UTC | #3
On Mon, Aug 03, 2020 at 10:43:11AM -0300, James Almer wrote:
> 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
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/mpegaudiodec_template.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will post an implementation of CRC checks for layer1 and 2.

[...]
diff mbox series

Patch

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);