Mercurial > audlegacy-plugins
changeset 3196:0f7180e3b163
alsa-ng: Enforce a minimum buffer size of 500ms.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sun, 12 Jul 2009 08:30:13 -0500 |
parents | 16d4308fb36e |
children | d2e01ca06335 |
files | src/alsa-ng/alsa-core.c |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alsa-ng/alsa-core.c Thu Jul 09 11:03:32 2009 -0400 +++ b/src/alsa-ng/alsa-core.c Sun Jul 12 08:30:13 2009 -0500 @@ -305,7 +305,7 @@ static gint alsaplug_open_audio(AFormat fmt, gint rate, gint nch) { - gint err, bitwidth, ringbuf_size; + gint err, bitwidth, ringbuf_size, buf_size; snd_pcm_format_t afmt; snd_pcm_hw_params_t *hwparams = NULL; @@ -342,11 +342,15 @@ bitwidth = snd_pcm_format_physical_width(afmt); bps = (rate * bitwidth * nch) >> 3; - ringbuf_size = aud_cfg->output_buffer_size * bps / 1000; + + buf_size = aud_cfg->output_buffer_size ? aud_cfg->output_buffer_size : 500; + ringbuf_size = buf_size * bps / 1000; + if (alsaplug_ringbuffer_init(&pcm_ringbuf, ringbuf_size) == -1) { _ERROR("alsaplug_ringbuffer_init failed"); return -1; } + pcm_going = TRUE; flush_request = -1;