There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?

1

Closed

BlockAlignReductionStream.Read cannot read large chunks.

description

The BlockAlignReductionStream uses a circular buffer to allow unaligned reading from an otherwise block aligned source stream. If the user tries to read more bytes than would fit in the circular buffer, the BlockAlignReductionStream only reads the amount
that fits in the circular buffer, but internally advanced the input stream by the actual requested number of bytes. Future read requests will therefore miss a portion of the input stream.

A simple fix would be to clamp the number of bytes read from the input stream to the size of the circular buffer. I could not find the svn url for the source tree or figure out where to submit a patch, so I just attached the modified source file.

comments

BlockAlignReductionStream is not really designed to be called with large values in the count parameter of Read. The trouble with this solution is that Read could return less than the requested number of bytes even though the stream has not ended, which
could cause partially complete buffers to get written to the soundcard.