Rate limit outgoing OSC messages per route#53
Open
paul-toben wants to merge 1 commit into
Open
Conversation
Adds a per-destination "Max Rate (Hz)" field that caps how often a route emits OSC messages. Coalesce semantics: when input arrives faster than the configured rate, only the most recent message survives the period and is emitted at the next interval boundary; nothing is sent during silence. Useful for streaming sources (PSN, ArtNet/sACN-driven OSC bridges) where the input rate can saturate downstream consoles. Scope: OSC outputs only. sACN, ArtNet, MIDI, OTP, and PSN destinations are unaffected. Default 0 = unlimited; existing configs are unchanged. Refactor: per-destination dispatch in ProcessRecvPacket extracted into DispatchBuiltPacket, which returns whether a real send happened so the rate-limit timer only advances on actual sends. The flush pass runs once per main loop iteration after the TCP-clients section.
Author
|
@MizPlusPlus This code is 99% written with AI and while I've looked it over and tested it, I haven't written any C since college. If the code is helpful, great. If it's not, I hope the framework for the features might be. |
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.
Adds a per-destination Max Rate (Hz) field to each route. When set, the route emits at most N OSC messages per second to that destination.
Behavior
Implementation
ProcessRecvPacketwas extracted intoDispatchBuiltPacket, which returns whether a real send happened. Both the immediate-send path and the deferred-flush path go through it.FlushPendingRateLimitedruns once per main loop iteration after the TCP-clients section and emits any pending coalesced packets whose period has elapsed..osc.txt(maxRateHz). Old configs load unchanged; new configs round-trip.Notes