[alsa-devel] [PATCH 2/2] aplay: Escape from pcm_write() when in_aborting state

Sergey sergemp at mail.ru
Fri Jun 13 08:59:57 CEST 2014


This patch fixes aplay freezing and not responding to Ctrl+C
when playback pcm is stuck and returns 0 to write attempts:
Example:
  # aplay -vvv /dev/zero
  pcm.!default {
    type plug
    slave.pcm { type null }
    slave.format S32_LE
  }
---
 aplay/aplay.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/aplay/aplay.c b/aplay/aplay.c
index 77e40a3..a5b9c2a 100644
--- a/aplay/aplay.c
+++ b/aplay/aplay.c
@@ -1921,7 +1921,7 @@ static ssize_t pcm_write(u_char *data, size_t count)
 		count = chunk_size;
 	}
 	data = remap_data(data, count);
-	while (count > 0) {
+	while (count > 0 && !in_aborting) {
 		if (test_position)
 			do_test_position();
 		check_stdin();
-- 
1.7.10.4


More information about the Alsa-devel mailing list