]> git.alsa-project.org Git - alsa-utils.git/commit
aplay: Handle 16bit sample negative overflow in peak calculations
authorTakashi Iwai <tiwai@suse.de>
Tue, 24 Aug 2021 07:36:33 +0000 (09:36 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 24 Aug 2021 07:53:53 +0000 (09:53 +0200)
commit5c4bf63a94ed0c20aca5bafb94ecd05893a45ec1
treec9f8fa45702ec3ce80734447d645abbde00f1e97
parent0ea7bfea83d97fefd18845948350322017a865c2
aplay: Handle 16bit sample negative overflow in peak calculations

The handling of 16bit samples in the peak calculations has a bug when
a sample with 0x8000 is passed.  As abs() treats 32bit int, it returns
0x8000.  And yet the code stores back into 16bit value again.

To fix that overflow, use 32bit value (i.e. val instead of sval) for
the further calculations.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
aplay/aplay.c