Merge pull request #916 from OpenShot/normalize-zero-samples

Do not divide by zero when normalizing audio waveforms
This commit is contained in:
Jonathan Thomas
2023-04-14 18:00:24 -05:00
committed by GitHub

View File

@@ -120,7 +120,7 @@ AudioWaveformData AudioWaveformer::ExtractSamples(int channel, int num_per_secon
// Scale all values to the -1 to +1 range (regardless of how small or how large the
// original audio sample values are)
if (normalize) {
if (normalize && samples_max > 0.0) {
float scale = 1.0f / samples_max;
data.scale(total_samples, scale);
}