Commit 2284ba64 authored by Mark Hills's avatar Mark Hills
Browse files

Prefer largest buffer size up to the user's limit

Previously we were setting the maximum buffer size. For some soundcards
this could allow the device to selecta much smaller buffer, leading to

Be more specific by using _near, which should match the user's expectations
and perhaps will fix problems with some soundcards.
parent f17a50a7
......@@ -111,8 +111,8 @@ static int pcm_open(struct alsa_pcm *alsa, const char *device_name,
p = buffer_time * 1000; /* microseconds */
dir = -1;
r = snd_pcm_hw_params_set_buffer_time_max(alsa->pcm, hw_params, &p, &dir);
if (!chk("hw_params_set_buffer_time_max", r)) {
r = snd_pcm_hw_params_set_buffer_time_near(alsa->pcm, hw_params, &p, &dir);
if (!chk("hw_params_set_buffer_time_near", r)) {
fprintf(stderr, "Buffer of %dms may be too small for this hardware.\n",
return -1;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment