mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 14:36:31 +01:00
aplay: Handle upper bound in peak calculations
Make sure that the calculated max_peak[] won't go beyond the sample max resolution. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
d9b3133815
commit
2efe124c31
1 changed files with 2 additions and 0 deletions
|
@ -1898,6 +1898,8 @@ static void compute_max_peak(u_char *data, size_t samples)
|
|||
max = 0x7fffffff;
|
||||
|
||||
for (c = 0; c < ichans; c++) {
|
||||
if (max_peak[c] > max)
|
||||
max_peak[c] = max;
|
||||
if (bits_per_sample > 16)
|
||||
perc[c] = max_peak[c] / (max / 100);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue