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.
This commit is contained in:
Martijn van Beurden 2023-05-19 08:12:55 +02:00
parent 69155423c4
commit 808efb3287
1 changed files with 7 additions and 0 deletions

View File

@ -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" };