add logic for video thread