From 8915ce1525e716707afbb335f364d47ae11a6339 Mon Sep 17 00:00:00 2001 From: Nick Moriarty Date: Thu, 16 Apr 2015 22:29:27 +0100 Subject: [PATCH] Fix ALSA latency (causing ALSA not to block). With arbitrarily large latency setting (unsigned int)-1, ALSA will happily accept all the samples we want to throw at it. Reducing to a reasonably long (but still sub-second) value of 100ms, we cause ALSA writes to block and work properly with --tx-carrier. --- src/simpleaudio-alsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simpleaudio-alsa.c b/src/simpleaudio-alsa.c index 1170ed8..0c1e0bf 100644 --- a/src/simpleaudio-alsa.c +++ b/src/simpleaudio-alsa.c @@ -155,7 +155,7 @@ sa_alsa_open_stream( channels, rate, 1 /* soft_resample (allow) */, - (unsigned int)-1 /* latency (allow max to avoid underruns) */); + 100000 /* latency (us) */); if (error) { fprintf(stderr, "E: %s\n", snd_strerror(error)); snd_pcm_close(pcm);