From: Andre Noll Date: Thu, 12 Mar 2009 20:37:26 +0000 (+0100) Subject: alsa: Revert 596d1d97f90854bd941db02f1353df8e1196ccc0 X-Git-Tag: v0.3.4~40 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=3b38d93529573b89089a67f494e17205d723021f;hp=70812d3cc48848784ea4c051fb47cdba965d2c9b alsa: Revert 596d1d97f90854bd941db02f1353df8e1196ccc0 This was really a brain fart. Instead, introduce a small delay in alsa_open() that defers audio data writing by 100ms. This seems to be enough to get rid of the buffer underruns with the udp sender. --- diff --git a/alsa_write.c b/alsa_write.c index f016e6ff..3a1e76e6 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -137,6 +137,7 @@ static int alsa_open(struct writer_node *w) PARA_INFO_LOG("bytes per frame: %zu\n", pad->bytes_per_frame); if (snd_pcm_nonblock(pad->handle, 1)) PARA_ERROR_LOG("failed to set nonblock mode\n"); + tv_add(now, &(struct timeval ){0, 100 * 1000}, &pad->next_chunk); return period_size * pad->bytes_per_frame; } @@ -181,8 +182,6 @@ static int alsa_write_post_select(__a_unused struct sched *s, if (ret == -EPIPE) { PARA_WARNING_LOG("EPIPE\n"); snd_pcm_prepare(pad->handle); - /* try to write the same data again */ - ret = snd_pcm_writei(pad->handle, data, frames); return 1; } if (ret < 0 && ret != -EAGAIN) {