diff options
author | Martijn van Beurden <mvanb1@gmail.com> | 2023-05-19 08:12:55 +0200 |
---|---|---|
committer | Martijn van Beurden <mvanb1@gmail.com> | 2023-05-20 07:29:04 +0200 |
commit | 808efb328717af811d24a8d59fdcc73f5f328b01 (patch) | |
tree | a92f3f2fc2d02dc22188d76f81984eec3d3d7f6a | |
parent | 69155423c41dd71c935afd3e84f043952cc2f5de (diff) | |
download | flac-808efb328717af811d24a8d59fdcc73f5f328b01.tar.gz |
Explicitly check for bps == 0 when applying replaygain
During application of replaygain, bps is checked to be > 0. This
should never happen in a valid file. This check is specific for
replaygain application instead of more generic (at streaminfo)
because we still want to be able to recover files in which
streaminfo is invalid or missing.
-rw-r--r-- | src/flac/decode.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/flac/decode.c b/src/flac/decode.c index d874b4b8..bb39fcd2 100644 --- a/src/flac/decode.c +++ b/src/flac/decode.c @@ -1543,6 +1543,13 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMet return; } } + else if(decoder_session->bps == 0) { + flac__utils_printf(stderr, 1, "%s: WARNING: can't apply ReplayGain, bit-per-sample value is invalid\n", decoder_session->inbasefilename); + if(decoder_session->treat_warnings_as_errors) { + decoder_session->abort_flag = true; + return; + } + } else { const char *ls[] = { "no", "peak", "hard" }; const char *ns[] = { "no", "low", "medium", "high" }; |