This project has moved and is read-only. For the latest updates, please go here.

Strange WasapiOut.FillBuffer(...) Issue With Zero-Byte Reads

Sep 8, 2014 at 8:29 PM
Hello there. Love the library, but am going through some growing pains with it. Already resolved the play/stop/play issue (see ISSUES section) but have another thing that I am not quite sure about.

While streaming data through WasapiOut via a BufferedWaveProvider (BWP) that is wrapped by a VolumeWaveProvider, we are occasionally seeing situations where FillBuffer(...) gets a read size of zero, causing the playback state to transition to Stopped, which causes the playback thread to exit.

This seems like normal behavior for situations where, for example, you hit the end of a WAVE file, but we are streaming in data and the underlying BWP still has data in its buffer. The code ends up inside ResamplerDmoStream.Read(...) and the count value provided causes the call to OutputToInputPosition(...) to return zero, causing a successful read of zero bytes, and a zero read-byte-count to be returned from the method.

This eventually causes playback to stop once the zero value finds it way back to FillBuffer(...). What I cannot figure out is, why is such a small number getting into this method such that a zero-byte read is the result?

Is there anything off the top of your head that I should be looking at/into?

Thanks much!

-=- James.