Skip to content

Commit cc617d7

Browse files
committed
vcap/ndi: handle source disconnect
1 parent 8e0504b commit cc617d7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/video_capture/ndi.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,15 @@ static struct video_frame *vidcap_ndi_grab(void *state, struct audio_frame **aud
455455
{ // No data
456456
case NDIlib_frame_type_none:
457457
LOG(LOG_LEVEL_INFO) << MOD_NAME << "No data received.\n";
458-
break;
458+
// check disconnect
459+
if (s->NDIlib->recv_get_no_connections(s->pNDI_recv) > 0) {
460+
break;
461+
}
462+
MSG(WARNING, "The source has disconnected, starting "
463+
"new lookup!\n");
464+
s->NDIlib->recv_destroy(s->pNDI_recv);
465+
s->pNDI_recv = nullptr;
466+
return nullptr;
459467

460468
// Video data
461469
case NDIlib_frame_type_video:

0 commit comments

Comments
 (0)