[PATCH] [UBUNTU:sound/core/] Fix snd_pcm_playback_silence() semantics

crimsun at fungus.sh.nu crimsun at fungus.sh.nu
Tue Oct 24 17:04:58 UTC 2006


From 9b3eb3207d52b62ebd118d4db56abe12ff21f7c2 Mon Sep 17 00:00:00 2001
From: Daniel T. Chen <crimsun at garnish.localdomain>
Date: Tue, 24 Oct 2006 13:03:52 -0400
Subject: [PATCH] [UBUNTU:sound/core/] Fix snd_pcm_playback_silence() semantics

UpstreamStatus: Added in upstream alsa-kernel hg changeset:
		4665: d07bc25fe370 [http://hg-mirror.alsa-project.org/alsa-kernel?cs=d07bc25fe370;style=raw ]

This commit from Clemens Ladisch fixes the broken case of
silence_size < boundary due to snd_pcm_playback_silence() not
agreeing whether silence_size points to the beginning or end
of the buffer to be silenced.

This commit is suitable as-is for Dapper, Edgy, and Feisty.

Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>
---
 sound/core/pcm_lib.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 3e989ae..23df94f 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -79,19 +79,17 @@ void snd_pcm_playback_silence(snd_pcm_su
 			runtime->silence_filled -= frames;
 			if ((snd_pcm_sframes_t)runtime->silence_filled < 0) {
 				runtime->silence_filled = 0;
-				runtime->silence_start = (ofs + frames) - runtime->buffer_size;
+				runtime->silence_start = new_hw_ptr;
 			} else {
-				runtime->silence_start = ofs - runtime->silence_filled;
+				runtime->silence_start = ofs;
 			}
-			if ((snd_pcm_sframes_t)runtime->silence_start < 0)
-				runtime->silence_start += runtime->boundary;
 		}
 		frames = runtime->buffer_size - runtime->silence_filled;
 	}
 	snd_assert(frames <= runtime->buffer_size, return);
 	if (frames == 0)
 		return;
-	ofs = (runtime->silence_start + runtime->silence_filled) % runtime->buffer_size;
+	ofs = runtime->silence_start % runtime->buffer_size;
 	while (frames > 0) {
 		transfer = ofs + frames > runtime->buffer_size ? runtime->buffer_size - ofs : frames;
 		if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED ||
-- 
1.4.1


-- 
Daniel T. Chen            crimsun at ubuntu.com
GPG key:  0xC88ABDA3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20061024/70353268/attachment.sig>


More information about the kernel-team mailing list