Don't receive frames from NDI if not showing#1404
Conversation
There was a problem hiding this comment.
Pull request overview
Reduces OBS performance impact from NDI sources configured as Keep Active by skipping NDI frame reception when the source is not currently being shown anywhere in OBS, addressing issue #1403.
Changes:
- Add an
obs_source_showing()gate in the NDI receive thread loop to avoid receiving frames when the source is hidden. - Add a small sleep when hidden to avoid busy-waiting.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@BitRate27 thanks for the fix. "Also tested in Studio mode with 2 scenes shown and witnessed a drop in frame rate from 30 to 7. When displaying a Multiview OBS becomes unusable, fps < 0.4." Does that happen WITH the fix or that is the behavior without the fix ? |
This is with the fix! It only really helps if in Normal mode. Studio Mode may be OK on a better machine, but Multiview will still suffer as all the sources are considered "showing", which is what it does now without the fix. I'll also add I am receiving a Full NDI feed generated locally, so HX3 may not have the same experience. I am considering another idea I had a while back and that is adding a Bandwidth option called "Low when showing but not on program". When chosen, it will use the low bandwidth setting on the receiver if it is showing, but not active. Would need to prototype it as there may be some latency as a new receiver needs to be created when switching from non active to active. |
|
Great! Thanks. That improvement can be logged in and managed in another dev cycle |
This is to fix issue 1403 [Bug]: Frame rate of OBS drops when using Keep Active and multiple scenes with 4K 60fps sources.
When Keep Active is chosen, the source receiving thread keeps running whether or not the source is actually showing anywhere in OBS. This effects the performance of OBS by wasting time receiving frames from NDI and passing them to OBS (which ends up ignoring).
The fix is simply to continue to the top of the NDI source thread loop before receiving frames if the source is not being shown.
Verified the fix works by creating 4 4K 60fps NDI sources loading a scene collection of 4 scenes with a NDI source in each. I was able to switch between scenes in Normal mode with no delay in seeing the feed. Also tested in Studio mode with 2 scenes shown and witnessed a drop in frame rate from 30 to 7. When displaying a Multiview OBS becomes unusable, fps < 0.4.