[nas] NAS, Cygwin, and "underruns"

Ryan C. Underwood nemesis at icequake.net
Wed Feb 11 18:57:07 MST 2009


I have an interesting problem with the Cygwin build of NAS on XP SP2.
I'm trying to simply play audio through it, but I am having a problem
with nasd pausing at some point due to a buffer underrun, according to
the AuStatusEvent that was generated.  This works fine when the app
connects to the nasd on Linux.  (Instead of the callback method, I am
using repeated AuWriteElement and keeping track of the buffer state so
as not to overfill it, and receiving any pending events in between
writes.)

When using nasd on Cygwin, the program seems to underrun, but in a very
strange way -- the low water event is usually not invoked first!  I have
so far been unable to get the Cygwin nasd to stop underrunning, but I
have a feeling the problem is not in the user code, but in the server,
because of this anomaly.  Specifically, the guess my 15-second glance at
the server code gave me is that the read() of the client socket is
returning a short amount.  This would cause the server to think it's
reached the end of data while having never invoked the low water event.

Trying to see what was going on, I pointed /dev/dsp to /dev/null on my
Linux VM, causing the sound to be consumed as quickly as possible.  Even
playing to this nasd swallowing the sound caused no buffer underruns.
Then I modified the client program to *not* check the state of the
buffer, but to simply write elements as fast as the sound can be
decoded.  The buffer went far into the negative over and over again, but
I *still* get underrun events on the Cygwin nasd.  So I don't think
there's a problem in my client program decoding fast or reliably enough
to refill the buffer in real time.

Making things a little more complicated, my Linux in this situation is
actually a coLinux running under a Windows XP host.  I use the Cygwin
nasd so that I can play sounds in Linux and forward them to the Windows
XP host.  The sound sounds fine, except it underruns and glitches about
once a second.  

So here are my questions to the group:

1)  Are there any other conditions besides the one I identified where,
once buffer is filled, an underrun event could occur without a low water
event having first occurred?

2)  Is NAS latency sensitive enough where oddities in the virtual
networking interface could be contributing to an underrun on the Cygwin
host?

3)  Anyone else do streaming audio through a Cygwin host that can
confirm the obvious, that I'm crazy and the only one seeing this
behavior?  :-)

Thanks.

-- 
Ryan C. Underwood, <nemesis at icequake.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://radscan.com/pipermail/nas/attachments/20090211/1b436b93/attachment.pgp>


More information about the Nas mailing list