Fix sleep behavior when ffmpeg return code is ERROR.