From: Andre Noll Date: Wed, 13 Jun 2012 15:53:07 +0000 (+0200) Subject: alsa: Do not buffer more than 500ms. X-Git-Tag: v0.4.11~11^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=3a56a6acd139ccc7a1a049d3e953aad1fa73a856 alsa: Do not buffer more than 500ms. In alsa_init() we set the buffer time to the maximum value supported by the device. However, on some systems this time is more than 10 seconds, which is much too high. This patch changes alsa_init() to use a buffer time of at most 0.5 seconds. --- diff --git a/alsa_write.c b/alsa_write.c index a4863a59..a211985a 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -113,6 +113,8 @@ static int alsa_init(struct private_alsa_write_data *pad, NULL); if (ret < 0 || buffer_time == 0) goto fail; + /* buffer at most 500 milliseconds */ + buffer_time = PARA_MIN(buffer_time, 500U * 1000U); msg = "could not set buffer time"; ret = snd_pcm_hw_params_set_buffer_time_near(pad->handle, hwparams, &buffer_time, NULL);