[alsa-devel] dsnoop issues

Jaroslav Kysela perex at suse.cz
Fri Apr 27 15:00:22 CEST 2007


On Fri, 27 Apr 2007, Takashi Iwai wrote:

> At Fri, 27 Apr 2007 13:27:00 +0100,
> Gordon Miller wrote:
> > 
> > Hi
> > 
> > All my snd_pcm_readi calls return too few frames. Also when I switch to 
> > stereo, the sound is muted. I cannot change this by adjusting period & 
> > buffer sizes. dsnoop is enabled by default. The documentation for 
> > snd_pcm_readi says that the only way that the frame count can be short 
> > is because of a signal or xrun. Well this clearly isn't the case.
> 
> Actually, the documentation is wrong, IMO.  The typical behavior of
> read syscall is that it returns a value actually read by that call.
> It doesn't guarantee whether the requested size is filled, and can be
> shorter than requested.  As snd_pcm_readi() emulates the read syscall,
> it should behave in that way.

I don't think so completely. For blocking mode (!O_NONBLOCK), all possible 
data should be read. Only signal or an error should break this.

The read logic for dsnoop is in snd_pcm_read_areas() in pcm/pcm.c 
(alsa-lib).

> The blocking mode means that the function waits until the threshold
> (watermark) condition is fulfilled.

I don't think so. The snd_pcm_read_areas() does only xfer_align alignment 
for wrong user input. If less frames are returned, then it is an error 
IMO.

						Jaroslav

-----
Jaroslav Kysela <perex at suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs


More information about the Alsa-devel mailing list