Skip to content

Commit e72168f

Browse files
authored
Merge pull request #916 from OpenShot/normalize-zero-samples
Do not divide by zero when normalizing audio waveforms
2 parents c472a24 + a961d98 commit e72168f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/AudioWaveformer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ AudioWaveformData AudioWaveformer::ExtractSamples(int channel, int num_per_secon
120120

121121
// Scale all values to the -1 to +1 range (regardless of how small or how large the
122122
// original audio sample values are)
123-
if (normalize) {
123+
if (normalize && samples_max > 0.0) {
124124
float scale = 1.0f / samples_max;
125125
data.scale(total_samples, scale);
126126
}

0 commit comments

Comments
 (0)