[PATCH - alsa-lib 1/1] Patch for another bug in snd_pcm_area_silence().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>

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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux