Skip to content

Commit 283b2e4

Browse files
authored
Don't process frames from NDI if source not showing (DistroAV#1404)
1 parent ad522f9 commit 283b2e4

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/ndi-source.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,17 @@ void *ndi_source_thread(void *data)
642642
ndiLib->recv_set_tally(ndi_receiver, &tally);
643643
}
644644

645+
//
646+
// If this source isn't showing in OBS then don't receive any frames from NDI. This occurs when multiple
647+
// scenes have NDI sources that are not being shown and behavior is set to Keep Active. Without this check,
648+
// the fps of OBS can decrease dramatically, especially with multiple 4K 60 sources.
649+
//
650+
if (!obs_source_showing(s->obs_source)) {
651+
// Avoid busy-waiting when the source is hidden but kept active.
652+
std::this_thread::sleep_for(std::chrono::milliseconds(5));
653+
continue;
654+
}
655+
645656
if (ndi_frame_sync) {
646657
//
647658
// ndi_frame_sync

0 commit comments

Comments
 (0)