[alsa-devel] [PATCH] Don't check if period size is equal to buffer size

Jaroslav Kysela perex at perex.cz
Fri Oct 2 10:45:31 CEST 2009


On Tue, 15 Sep 2009, Lubomir Rintel wrote:

> At least some drivers seem to allow a single period and those which
> don't would correct us anyway. Moreover, Pulseaudio with tsched sets
> this frequently.

I'm afraid, but this patch is not enough. At least chunk_size should be 
less than buffer_size otherwise you'll get underrun immediately.

 						Jaroslav

> ---
> aplay/aplay.c |    5 -----
> 1 files changed, 0 insertions(+), 5 deletions(-)
>
> diff --git a/aplay/aplay.c b/aplay/aplay.c
> index c7c82a1..4fa36cb 100644
> --- a/aplay/aplay.c
> +++ b/aplay/aplay.c
> @@ -1044,11 +1044,6 @@ static void set_params(void)
> 	}
> 	snd_pcm_hw_params_get_period_size(params, &chunk_size, 0);
> 	snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
> -	if (chunk_size == buffer_size) {
> -		error(_("Can't use period equal to buffer size (%lu == %lu)"),
> -		      chunk_size, buffer_size);
> -		exit(EXIT_FAILURE);
> -	}
> 	snd_pcm_sw_params_current(handle, swparams);
> 	if (avail_min < 0)
> 		n = chunk_size;

-----
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.



More information about the Alsa-devel mailing list