TODO: find a more reliable way to determine if the calling thread is the
video driver thread or not.