]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fixed the period size setup for hardware with fixed values
authorJaroslav Kysela <perex@perex.cz>
Fri, 16 Nov 2001 10:59:29 +0000 (10:59 +0000)
committerJaroslav Kysela <perex@perex.cz>
Fri, 16 Nov 2001 10:59:29 +0000 (10:59 +0000)
test/latency.c

index 84f9a041eccb782b63cec3bbad842ad685706ec4..0105568c389b5f7fc8a8a104bc36725c2eca393b 100644 (file)
@@ -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) {