improved the media processing thread management and fixed a bug