diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2010-05-21 03:15:59 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-05-21 10:33:34 -0400 |
commit | ead4046b2fdfd69acc4272e693afd249ad3eb689 (patch) | |
tree | 9dbc91adb9f4c654f6b9eaa245422162f12e8e47 /sound/core/pcm_lib.c | |
parent | 7f06a8b26aba1dc03b42272dc0089a800372c575 (diff) |
ALSA: pcm: fix the fix of the runtime->boundary calculation
Commit 7910b4a1db63fefc3d291853d33c34c5b6352e8e in 2.6.34 changed the
runtime->boundary calculation to make this value a multiple of both the
buffer_size and the period_size, because the latter is assumed by the
runtime->hw_ptr_interrupt calculation.
However, due to the lack of a ioctl that could read the software
parameters before they are set, the kernel requires that alsa-lib
calculates the boundary value, too. The changed algorithm leads to
a different boundary value used by alsa-lib, which makes, e.g., mplayer
fail to play a 44.1 kHz file because the silence_size parameter is now
invalid; bug report:
<https://bugtrack.alsa-project.org/alsa-bug/view.php?id=5015>.
This patch reverts the change to the boundary calculation, and instead
fixes the hw_ptr_interrupt calculation to be period-aligned regardless
of the boundary value.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/pcm_lib.c')
-rw-r--r-- | sound/core/pcm_lib.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index a2ff86189d2a..22aff180dd1f 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -439,8 +439,13 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, | |||
439 | snd_pcm_playback_silence(substream, new_hw_ptr); | 439 | snd_pcm_playback_silence(substream, new_hw_ptr); |
440 | 440 | ||
441 | if (in_interrupt) { | 441 | if (in_interrupt) { |
442 | runtime->hw_ptr_interrupt = new_hw_ptr - | 442 | delta = new_hw_ptr - runtime->hw_ptr_interrupt; |
443 | (new_hw_ptr % runtime->period_size); | 443 | if (delta < 0) |
444 | delta += runtime->boundary; | ||
445 | delta -= (snd_pcm_uframes_t)delta % runtime->period_size; | ||
446 | runtime->hw_ptr_interrupt += delta; | ||
447 | if (runtime->hw_ptr_interrupt >= runtime->boundary) | ||
448 | runtime->hw_ptr_interrupt -= runtime->boundary; | ||
444 | } | 449 | } |
445 | runtime->hw_ptr_base = hw_base; | 450 | runtime->hw_ptr_base = hw_base; |
446 | runtime->status->hw_ptr = new_hw_ptr; | 451 | runtime->status->hw_ptr = new_hw_ptr; |