[alsa-devel] SALSA-Lib: Playback overrun on initial PCM start

J. Scott Merritt alsauser at pragmasoft.com
Fri Jun 29 19:33:46 CEST 2007


On Fri, 29 Jun 2007 19:15:00 +0200
Takashi Iwai <tiwai at suse.de> wrote:

> At Fri, 29 Jun 2007 12:26:45 -0400,
> J. Scott Merritt wrote:
> > 
> > I no longer get the PlayBack overrun on PCM start.  However, it appears
> > that "poll" or the snd_pcm_sw_params_set_avail_min (=4096) is not being
> > properly honored.  With the normal alsa-lib, when the "poll" returns
> > snd_pcm_avail_update reports that space is available for 4096 frames.
> > However, in my initial testing, when running with SALSA lib, only about
> > 100 frames or so are available when the poll returns.
> > 
> > I will examine this more closely.
> 
> Found out another bug.  Try the patch below.
> 
> Thanks for reporting!
> 
> 
> Takashi
> 
> diff -r ad2c81608e10 src/pcm.c
> --- a/src/pcm.c	Fri Jun 29 17:59:52 2007 +0200
> +++ b/src/pcm.c	Fri Jun 29 19:12:04 2007 +0200
> @@ -857,6 +857,7 @@ static int snd_pcm_hw_mmap_status(snd_pc
>  		pcm->mmap_status = NULL;
>  		goto no_mmap;
>  	}
> +	pcm->mmap_control->avail_min = 1;
>  	return 0;
>  
>   no_mmap:
> @@ -865,6 +866,7 @@ static int snd_pcm_hw_mmap_status(snd_pc
>  		return -ENOMEM;
>  	pcm->mmap_status = &pcm->sync_ptr->s.status;
>  	pcm->mmap_control = &pcm->sync_ptr->c.control;
> +	pcm->mmap_control->avail_min = 1;
>  	_snd_pcm_sync_ptr(pcm, 0);
>  	return 0;
>  }
> diff -r ad2c81608e10 src/pcm_params.c
> --- a/src/pcm_params.c	Fri Jun 29 17:59:52 2007 +0200
> +++ b/src/pcm_params.c	Fri Jun 29 19:12:04 2007 +0200
> @@ -1052,6 +1052,7 @@ int snd_pcm_sw_params(snd_pcm_t *pcm, sn
>  	if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_SW_PARAMS, params) < 0)
>  		return -errno;
>  	pcm->sw_params = *params;
> +	pcm->mmap_control->avail_min = params->avail_min;
>  	return 0;
>  }

That did the trick :)

Many thanks for the extremely quick and accurate assistance !

Best regards, Scott.









More information about the Alsa-devel mailing list