From 393c52c9e726570a2ee287e9f7e103b619a28f73 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 7 May 2013 11:15:07 +0200 Subject: [PATCH] alsa: Set period time. This is probably not necessary, but since aplay from the alsa-utils package sets it in the same way, it can't hurt to do this. --- alsa_write.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/alsa_write.c b/alsa_write.c index 11e4504d..e75fa230 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -80,6 +80,7 @@ static int alsa_init(struct private_alsa_write_data *pad, unsigned buffer_time; int ret; const char *msg; + unsigned period_time; PARA_INFO_LOG("opening %s\n", conf->device_arg); msg = "unable to open pcm"; @@ -124,6 +125,13 @@ static int alsa_init(struct private_alsa_write_data *pad, &buffer_time, NULL); if (ret < 0) goto fail; + period_time = buffer_time / 4; + msg = "could not set period time"; + ret = snd_pcm_hw_params_set_period_time_near(pad->handle, hwparams, + &period_time, 0); + if (ret < 0) + goto fail; + msg = "unable to install hw params"; ret = snd_pcm_hw_params(pad->handle, hwparams); if (ret < 0) -- 2.39.5