Fix the default buffer size calculation in speaker-test

Fixed the default buffer size calculation in speaker-test.
The size should be aligned to nperiods.
This commit is contained in:
Takashi Iwai 2006-05-12 18:07:07 +02:00
parent 10e3f81ef7
commit 7af6e01ace

View file

@ -342,6 +342,8 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params, snd_pcm_
} }
if (! buffer_time && ! period_time) { if (! buffer_time && ! period_time) {
buffer_size = buffer_size_max; buffer_size = buffer_size_max;
if (! period_time)
buffer_size = (buffer_size / nperiods) * nperiods;
printf(_("Using max buffer size %lu\n"), buffer_size); printf(_("Using max buffer size %lu\n"), buffer_size);
err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &buffer_size); err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &buffer_size);
if (err < 0) { if (err < 0) {