From 3a56a6acd139ccc7a1a049d3e953aad1fa73a856 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 13 Jun 2012 17:53:07 +0200 Subject: [PATCH] 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. --- alsa_write.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.30.2