[AVSwitch] some cleanup and recoding for better support.