All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH - alsa-lib 1/1] Patch for another bug in snd_pcm_area_silence().
@ 2018-02-01 18:12 furrywolf
  2018-02-02  6:41 ` Takashi Sakamoto
  0 siblings, 1 reply; 5+ messages in thread
From: furrywolf @ 2018-02-01 18:12 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, furrywolf

Only silence areas 64 bits at a time if it's possible to do so, which is
when either the silence values are all zero, or when the format width
divides evenly into 64 bits.  For formats that are neither of these, let
the width-specific code handle the entire silencing.  Silencing formats
that are not evenly divisible into 64 bits in 64-bit chunks, when the
data isn't just zeroes, results in values being written to shifting
positions in the sample, giving garbage.

Makes Takashi Sakamoto's tester happy for all tests.  Yay!  (And Thanks!)

Signed-off-by: furrywolf <alsa2@bushytails.net>

diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 1753cda..5f9bd9f 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -2947,7 +2947,7 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes
 	dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
 	width = snd_pcm_format_physical_width(format);
 	silence = snd_pcm_format_silence_64(format);
-	if (dst_area->step == (unsigned int) width) {
+	if (dst_area->step == (unsigned int) width && (!silence || !(64 % width))) {
 		unsigned int dwords = samples * width / 64;
 		uint64_t *dstp = (uint64_t *)dst;
 		samples -= dwords * 64 / width;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-05 14:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-01 18:12 [PATCH - alsa-lib 1/1] Patch for another bug in snd_pcm_area_silence() furrywolf
2018-02-02  6:41 ` Takashi Sakamoto
2018-02-05  9:06   ` Jaroslav Kysela
2018-02-05  9:30     ` Michael Nazzareno Trimarchi
2018-02-05 14:22     ` Jaroslav Kysela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.