Move packet tracking into ALSA thread class.
This simplifies the buffer itself a bit, and will
enable some optimisations to avoid waking Python too often.