audio: refactor the handleFormatChanged / threadStarted code
Test using ffmpeg's resampler