From: Jaroslav Kysela Date: Fri, 16 Nov 2001 10:59:29 +0000 (+0000) Subject: Fixed the period size setup for hardware with fixed values X-Git-Tag: v1.0.3~598 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=ef035eacfe13278b303cc41d34511fb949becef6;p=alsa-lib.git Fixed the period size setup for hardware with fixed values --- diff --git a/test/latency.c b/test/latency.c index 84f9a041..0105568c 100644 --- a/test/latency.c +++ b/test/latency.c @@ -218,14 +218,18 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize) exit(0); } - size = snd_pcm_hw_params_get_buffer_size(p_params) / 2; + size = snd_pcm_hw_params_get_period_size(p_params, NULL); if (size > *bufsize) *bufsize = size; - size = snd_pcm_hw_params_get_buffer_size(c_params) / 2; + size = snd_pcm_hw_params_get_period_size(c_params, NULL); if (size > *bufsize) *bufsize = size; - if (snd_pcm_hw_params_get_buffer_size(p_params) != - snd_pcm_hw_params_get_buffer_size(c_params)) + if (snd_pcm_hw_params_get_period_time(p_params, NULL) != + snd_pcm_hw_params_get_period_time(c_params, NULL)) + goto __again; + if (snd_pcm_hw_params_get_period_size(p_params, NULL) * 2 < snd_pcm_hw_params_get_buffer_size(p_params)) + goto __again; + if (snd_pcm_hw_params_get_period_size(c_params, NULL) * 2 < snd_pcm_hw_params_get_buffer_size(c_params)) goto __again; if ((err = setparams_set(phandle, p_params, p_swparams, "playback")) < 0) {