[alsa-devel] [PATCH 1/2] pcm: break out of snd_pcm_write_areas() if write function returned 0
Sergey
sergemp at mail.ru
Fri Jun 13 08:58:47 CEST 2014
When pcm is stuck and write func returns 0, snd_pcm_write_areas() loops
infinitely freezing the application and not allowing it to handle the case.
Can be reproduced with:
# aplay -vvv /dev/zero
pcm.!default {
type plug
slave.pcm { type null }
slave.format S32_LE
}
This patch fixes it by breaking the loop if func returns 0.
Note: pcm_null stuckness must be fixed on its own.
---
src/pcm/pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 7e46014..5bb7582 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -6816,7 +6816,7 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area
if (! frames)
break;
err = func(pcm, areas, offset, frames);
- if (err < 0)
+ if (err <= 0)
break;
frames = err;
if (state == SND_PCM_STATE_PREPARED) {
--
1.7.10.4
More information about the Alsa-devel
mailing list