diff options
author | Martijn van Beurden <mvanb1@gmail.com> | 2023-06-18 20:32:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-18 20:32:27 +0200 |
commit | 08f8af084593fc5667cadbb1883b6e5004908917 (patch) | |
tree | 45484f3d025e33fad3a05efb604f71893b0dad29 | |
parent | d80e574451da8a515afb55d113c731344a667e55 (diff) | |
download | flac-08f8af084593fc5667cadbb1883b6e5004908917.tar.gz |
Improve on "Check for got_stream_info instead of samplerate being 0"
This improves on commit 6db29d1. It turns that commit broke some
parsing, this fixes it
-rw-r--r-- | .github/workflows/distcheck.yml | 2 | ||||
-rw-r--r-- | src/flac/decode.c | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/.github/workflows/distcheck.yml b/.github/workflows/distcheck.yml index d4802c74..3bafb225 100644 --- a/.github/workflows/distcheck.yml +++ b/.github/workflows/distcheck.yml @@ -40,7 +40,7 @@ jobs: abi-compliance-checker -l flac++ -old test/abi/abi-libFLAC++-1.4.0.dump -new test/abi/abi-descriptor-libFLAC++-1.4.0.xml - name: Check with flac test files - run: ./src/flac/flac -t test-files/subset/*.flac test-files/uncommon/0[15-9]*.flac + run: ./src/flac/flac -t test-files/subset/*.flac test-files/uncommon/0[5-9]*.flac test-files/uncommon/10*.flac - name: Upload ABI compliance reports uses: actions/upload-artifact@v3 diff --git a/src/flac/decode.c b/src/flac/decode.c index bc9c106c..90f7a6c8 100644 --- a/src/flac/decode.c +++ b/src/flac/decode.c @@ -242,7 +242,7 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__ d->has_md5sum = false; d->bps = 0; d->channels = 0; - d->sample_rate = 0; + d->sample_rate = UINT32_MAX; d->channel_mask = 0; d->decode_position = 0; @@ -1172,7 +1172,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder } /* sanity-check the sample rate */ - if(!decoder_session->got_stream_info) { + if(decoder_session->sample_rate < UINT32_MAX) { if(frame->header.sample_rate != decoder_session->sample_rate) { if(decoder_session->got_stream_info) flac__utils_printf(stderr, 1, "%s: ERROR, sample rate is %u in frame but %u in STREAMINFO\n", decoder_session->inbasefilename, frame->header.sample_rate, decoder_session->sample_rate); @@ -1183,6 +1183,8 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder } } else { + /* must not have gotten STREAMINFO, save the sample rate from the frame header */ + FLAC__ASSERT(!decoder_session->got_stream_info); decoder_session->sample_rate = frame->header.sample_rate; } |