added intial async audio/video code, fixed a few bugs, improved thread safety, and made a few other minor adjustments