[alsa-devel] Hang in snd_pcm_writei with alsa-pulse plugin

Raymond Yau superquad.vortex2 at gmail.com
Tue Nov 2 09:23:58 CET 2010


2010/11/2 Matthew Gregan <kinetik at flim.org>

> At 2010-11-02T10:43:54+0800, Raymond Yau wrote:
> > No much response because there are bugs in atest2.c
> >
> >   /* prefill sound buffers and begin playback */
> >   fill(pcm);
> >
> >   while (++count) {
> >
> > The program had filled the buffer but the output does not indicate those
> > write
>
> This doesn't affect the result of the testcase.  count is only used to
> pause
> and resume less frequently than every iteration of the write loop.
>
> > I can confirm that the program seem hang after a few pause/unpause when
> > using alsa-pulse plugin
> >
> > However it assert when using hw device
> >
> >   assert(bsize / psize >= 4);
>
> The assert is present because I've only tested on systems where this
> assertion holds true.  It's likely that the loop timing would need to be
> changed to work correctly in other cases.
>
> Thanks for confirming that you can reproduce the problem.  I've since
> discovered that it's possible to produce the same problem with the
> PulseAudio API directly, so I'll take this up on pulseaudio-discuss at .
>
> Cheers,
> -mjg
>

The interesting thing is it did not hang when I increase the sleep time to
one period


    /* sleep for half a period */
+    usleep(psize * 1000000 / RATE );
-    usleep(psize * 1000000 / RATE /2 );


More information about the Alsa-devel mailing list