[alsa-devel] [Pkg-alsa-devel] Bug#438118: alsa-utils: aplay non-blocking mode isn't working

Takashi Iwai tiwai at suse.de
Tue Sep 18 17:45:24 CEST 2007


At Tue, 18 Sep 2007 09:41:48 +0200 (CEST),
Anders Boström wrote:
> 
> >>>>> "TI" == Takashi Iwai <tiwai at suse.de> writes:
> 
> Hi!
> 
>  >> Hi all,
>  >> 
>  >> can one please have a lokk at this? aplay -N isn't working for the
>  >> OP.
> 
>  TI> Cannot reproduce here.  Could you _post_ more details?
> 
> OK, I've tested more, and discovered that the problem seems to be that
> the end of the sound is cut in non-blocking mode. And if I play a very
> short sound-file, I can't hear anything. Blocking mode works fine.
> 
> When using non-blocking mode, an strace contains "ioctl(4, 0x4144,
> 0x2b9f785d8000)        = -1 EAGAIN (Resource temporarily
> unavailable)". Blocking mode never contains the EAGAIN response.
> 
> I attach two files. When playing halt.au, I can only hear the start,
> about as much as "ha". When playing metal.au, I can't hear anything.

OK, thanks, I see the problem now.

I don't remember whether it's a feature or a bug.  The drain ioctl
rejects the non-block mode.

Anyway, a simple patch is below.  Let me know if it works.


Takashi

diff -r 0028e39ead78 core/pcm_native.c
--- a/core/pcm_native.c	Tue Sep 18 00:52:38 2007 +0200
+++ b/core/pcm_native.c	Tue Sep 18 17:44:31 2007 +0200
@@ -1368,8 +1368,6 @@ static int snd_pcm_prepare(struct snd_pc
 
 static int snd_pcm_pre_drain_init(struct snd_pcm_substream *substream, int state)
 {
-	if (substream->f_flags & O_NONBLOCK)
-		return -EAGAIN;
 	substream->runtime->trigger_master = substream;
 	return 0;
 }


More information about the Alsa-devel mailing list