wait input/output thread exit before stop
add mutex for video parameter change