]> git.alsa-project.org Git - alsa-lib.git/commit
pcm: Fix two bugs in snd_pcm_area_silence()
authorfurrywolf <alsa2@bushytails.net>
Sun, 21 Jan 2018 03:27:03 +0000 (19:27 -0800)
committerJaroslav Kysela <perex@perex.cz>
Mon, 5 Feb 2018 08:48:01 +0000 (09:48 +0100)
commite24dc73bd61008bb31158f7c946b03302255f68a
treed9ddbabaf12ab546c0cb60fb385c465a92afa679
parent6e555781259281e31f8b5dc518a317511d67bbd8
pcm: Fix two bugs in snd_pcm_area_silence()

First, after silencing the buffer 64 bits at a time, any remaining samples
need to be silenced by the following width-specific code.  However, instead
of silencing the end of the buffer, the code instead re-silences the start
of the buffer, leaving the end unsilenced.  To fix this, update the pointer
used by the width-specific code to point to the end of the area just
silenced, instead of leaving it pointing to the start of the buffer.

Second, the code for 24 bit samples can only silence a single sample, as
there's no loop for multiple samples as with other formats.  To fix this,
add a loop similar to the ones used for every other width.

The symptoms of these bugs are random data at the end of every supposedly
silenced buffer with certain format/buffer size combinations, resulting in
pops and noise.

Signed-off-by: furrywolf <alsa2@bushytails.net>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/pcm/pcm.c