AudioBuffer: Added more checks to avoid premature purges.

If the buffer is full (the track was preloaded long ago) and the client starts analyzing the track with many parallel streams (like XBMC does), there are chances for Spotify's music_delivery() callback to kick in and delete frames that are not yet delivered to some streams. This causes random "too late my friend" errors.

This is related to mazkolain/spotimc#127.
audio: remove unused code.
audio: BufferManager: Add locking to avoid potential race conditions.

This should close mazkolain/spotimc#127.