Rewrite the video/audio logic and fix two critical vulnerabilities

Heh, you probably have seen one of those...