Fix clipping

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Improve error handling

Make sure to handle errors when writing the sample buffer as well as partial
writes. Also print an error and abort if either dequeuing or enqueuing a block
failed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>