Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible regression somewhere between 1.3.3 and 1.4.2 causing CRC mismatch and lost sync #525

Closed
wader opened this issue Nov 30, 2022 · 9 comments

Comments

@wader
Copy link

wader commented Nov 30, 2022

Hi, i was verifying a fix when i noticed that the sample file from https://trac.ffmpeg.org/ticket/9621 works fine with 1.3.3 but fails to decode with 1.4.2.

$ flac -d -o flac_decode_bug.ref.flac  flac_decode_bug.flac
flac 1.3.3
Copyright (C) 2000-2009  Josh Coalson, 2011-2016  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

flac_decode_bug.flac: done
$ flac -d -o flac_decode_bug.ref.wav flac_decode_bug.flac
flac 1.4.2
Copyright (C) 2000-2009  Josh Coalson, 2011-2022  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

flac_decode_bug.flac: *** Got error code 2:FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
*** Got error code 2:FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC


flac_decode_bug.flac: ERROR during decoding
                      state = FLAC__STREAM_DECODER_END_OF_STREAM
@wader
Copy link
Author

wader commented Nov 30, 2022

Seems like test file from https://trac.ffmpeg.org/ticket/9906 has similar issue. Something to do with small files, single frame?

@ktmf01
Copy link
Collaborator

ktmf01 commented Nov 30, 2022

Hi,

Thanks for filling this issue. I don't seem to be able to reproduce this. The sample in ffmpeg trac ticker 9621 decodes just fine. The file in ticket 9906 gives the same console output as FLAC 1.2.0, I don't know what you're seeing there?

@wader
Copy link
Author

wader commented Nov 30, 2022

Hmm strange, something fishy is going on 🤔 i thought maybe the flac version from brew is strange but look at this:

$ docker run --rm -ti -v $PWD:$PWD -w $PWD alpine:3.17 sh -c 'apk add flac && md5sum flac_decode_bug.flac && flac -t flac_decode_bug.flac'
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.17/community/x86_64/APKINDEX.tar.gz
(1/5) Installing libgcc (12.2.1_git20220924-r4)
(2/5) Installing libogg (1.3.5-r1)
(3/5) Installing libstdc++ (12.2.1_git20220924-r4)
(4/5) Installing flac-libs (1.4.2-r0)
(5/5) Installing flac (1.4.2-r0)
Executing busybox-1.35.0-r29.trigger
OK: 10 MiB in 20 packages
386fdb1480b696b7e07e7d6362184ecb  flac_decode_bug.flac

flac 1.4.2
Copyright (C) 2000-2009  Josh Coalson, 2011-2022  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

flac_decode_bug.flac: *** Got error code 2:FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
*** Got error code 2:FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
*** Got error code 1:FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
*** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC


flac_decode_bug.flac: ERROR during decoding
                      state = FLAC__STREAM_DECODER_END_OF_STREAM


$ docker run --rm -ti -v $PWD:$PWD -w $PWD alpine:3.16 sh -c 'apk add flac && md5sum flac_decode_bug.flac && flac -t flac_decode_bug.flac'
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
(1/4) Installing libgcc (11.2.1_git20220219-r2)
(2/4) Installing libogg (1.3.5-r1)
(3/4) Installing libstdc++ (11.2.1_git20220219-r2)
(4/4) Installing flac (1.3.4-r0)
Executing busybox-1.35.0-r15.trigger
OK: 8 MiB in 18 packages
386fdb1480b696b7e07e7d6362184ecb  flac_decode_bug.flac

flac 1.3.4
Copyright (C) 2000-2009  Josh Coalson, 2011-2016  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

flac_decode_bug.flac: ok

@ktmf01
Copy link
Collaborator

ktmf01 commented Nov 30, 2022

The file I downloaded from trac ticker 9621 has MD5sum '18cb34f6fc32a853b9ae4780f47d3cb8' and is called flac_validate_bug.flac and not flac_decode_bug.flac. Could it be you're using a FLAC file different from what is attached to 9621?

@wader
Copy link
Author

wader commented Nov 30, 2022

Sorry for the confusion, to many tickets, flac_decode_bug.flac can you found in ticket https://trac.ffmpeg.org/ticket/9297 and has md5 386fdb1480b696b7e07e7d6362184ecb

(flac_validate_bug.flac works fine for me too)

@ktmf01
Copy link
Collaborator

ktmf01 commented Nov 30, 2022

After some research, it seems this is a duplicate of issue #464. The sent error isn't very descriptive. The CRC is fine actually, the samples encoded in the frame are out-of-range. This is the result of a check introduced in commit 1793632 It says:

Also, decoded values are checked to be within bps

@wader
Copy link
Author

wader commented Nov 30, 2022

Ah ok, so close this issue?

Also was nice to meet at NTTW6!

@ktmf01
Copy link
Collaborator

ktmf01 commented Nov 30, 2022

Yes, I will close the issue. Sadly, adding another error message breaks API compatibility, so I'll postpone it to group it with other API changes.

It was certainly nice to meet you. Sorry that the livestream/capture isn't of the highest quality, there were some changes in the equipment that morning that introduced problems we had to fix during your presentation. Of all presentations, you had the one with the smallest on-screen text (as it was a demo instead of a presentation) but sadly that was the one where the screen capture didn't work. 😞

@ktmf01 ktmf01 closed this as completed Nov 30, 2022
@wader
Copy link
Author

wader commented Nov 30, 2022

Yes, I will close the issue. Sadly, adding another error message breaks API compatibility, so I'll postpone it to group it with other API changes.

👍

It was certainly nice to meet you. Sorry that the livestream/capture isn't of the highest quality, there were some changes in the equipment that morning that introduced problems we had to fix during your presentation. Of all presentations, you had the one with the smallest on-screen text (as it was a demo instead of a presentation) but sadly that was the one where the screen capture didn't work. 😞

No worries! it was fun and people seems to have liked the presentation. Hope i can go next year also. BTW there will be a both a binary tools and media track as FOSDEM this this, i've sent a proposal to talk about fq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants