check AVFormatContext before read. exit extract thread before close