added better audio sync and image buffer handling