Fix NDI feed stagnation when capture pipeline is idle (#92)#94
Merged
Conversation
The hidden broadcast window's capture loop is driven by the main window's RequestAnimationFrame, which stops firing during periods of user inactivity. Without fresh snapshots, the send thread had nothing to transmit and OBS would declare the NDI source dead after a few seconds. Cache the last successfully sent frame and re-transmit it on the send thread's TryTake timeout so the feed continues emitting frames (~4 Hz) whenever the capture pipeline goes silent. When state changes resume, fresh frames replace the cache and flow normally. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RequestAnimationFrame, which stops firing when the user is idle. With no fresh snapshots, the send thread had nothing to transmit and the NDI receiver timed out.TryTaketimeout (~250 ms) so the feed continues emitting frames whenever the capture pipeline goes silent. When state changes resume, fresh frames replace the cache and flow normally.Implementation notes
SendVideoFrame(...)helper fromProcessOneFrameso both the live and heartbeat paths share one code path.Dispose.Test plan
dotnet build(verified clean, 0 warnings)EnableBackgroundNdion, connect OBS as an NDI receiver, leave idle for 5+ minutes — feed should stay alive (previously went silent within ~1 minute)🤖 Generated with Claude Code