Don't glitch on the first good packet if previous was a glitch#1437
Merged
mikedickey merged 1 commit intodevfrom Jun 26, 2025
Merged
Don't glitch on the first good packet if previous was a glitch#1437mikedickey merged 1 commit intodevfrom
mikedickey merged 1 commit intodevfrom
Conversation
If the previous call returned a predicted result (glitch), and we have a good packet available, don't process it as a glitch. Updated changelog for 2.7.0-beta2 release
d6f8765 to
07d2948
Compare
cchafe
approved these changes
Jun 26, 2025
Collaborator
cchafe
left a comment
There was a problem hiding this comment.
huge win!
tested vs. current dev branch and in the overrun case it outperforms amazingly
mikedickey
added a commit
that referenced
this pull request
Jan 25, 2026
This builds upon the refinement introduced by: #1437 That PR allowed us to use a good packet ignoring skips if the previous callback was serviced using a prediction (glitch). However, we were still effectively throwing out the next good packet whenever there were skips and the previous callback was not serviced using a prediction. This PR takes a slightly different approach by allowing us to stash and use the next good packet on the following callback. This also helps slow down jumping sequence numbers when there are multiple skipped packets in a row (which causes abrupt drops in latency). This also addresses a special case where we are only skipping a single good packet due to tolerance. Rather than returning a prediction, we allow it to use the packet. For this to work, we need to ease the tolerance restrictions slightly by allowing it to sometimes expand by the duration of an additional packet. Effectively, this also means that tolerance restrictions alone will only cause glitches when the skew exceeds at least one packet in duration. My initial testing indicates that these changes significantly reduce glitch counts, by as much as 2x, resulting in a slightly improved signal (at least to my ears). sudo tc qdisc add dev eth0 root netem slot distribution pareto 0.1ms 3.0ms loss 10%
mikedickey
added a commit
that referenced
this pull request
Jan 25, 2026
This builds upon the refinement introduced by: #1437 That PR allowed us to use a good packet ignoring skips if the previous callback was serviced using a prediction (glitch). However, we were still effectively throwing out the next good packet whenever there were skips and the previous callback was not serviced using a prediction. This PR takes a slightly different approach by allowing us to stash and use the next good packet on the following callback. This also helps slow down jumping sequence numbers when there are multiple skipped packets in a row (which causes abrupt drops in latency). This also addresses a special case where we are only skipping a single good packet due to tolerance. Rather than returning a prediction, we allow it to use the packet. For this to work, we need to ease the tolerance restrictions slightly by allowing it to sometimes expand by the duration of an additional packet. Effectively, this also means that tolerance restrictions alone will only cause glitches when the skew exceeds at least one packet in duration. My initial testing indicates that these changes significantly reduce glitch counts, by as much as 2x, resulting in a slightly improved signal (at least to my ears). sudo tc qdisc add dev eth0 root netem slot distribution pareto 0.1ms 3.0ms loss 10%
mikedickey
added a commit
that referenced
this pull request
Jan 25, 2026
This builds upon the refinement introduced by: #1437 That PR allowed us to use a good packet ignoring skips if the previous callback was serviced using a prediction (glitch). However, we were still effectively throwing out the next good packet whenever there were skips and the previous callback was not serviced using a prediction. This PR takes a slightly different approach by allowing us to stash and use the next good packet on the following callback. This also helps slow down jumping sequence numbers when there are multiple skipped packets in a row (which causes abrupt drops in latency). This also addresses a special case where we are only skipping a single good packet due to tolerance. Rather than returning a prediction, we allow it to use the packet. For this to work, we need to ease the tolerance restrictions slightly by allowing it to sometimes expand by the duration of an additional packet. Effectively, this also means that tolerance restrictions alone will only cause glitches when the skew exceeds at least one packet in duration. My initial testing indicates that these changes significantly reduce glitch counts, by as much as 2x, resulting in a slightly improved signal (at least to my ears). sudo tc qdisc add dev eth0 root netem slot distribution pareto 0.1ms 3.0ms loss 10% This also eliminates the use of "goto" statements, and includes a fix for building libsamplerate with cmake 4.x
mikedickey
added a commit
that referenced
this pull request
Jan 25, 2026
This builds upon the refinement introduced by: #1437 That PR allowed us to use a good packet ignoring skips if the previous callback was serviced using a prediction (glitch). However, we were still effectively throwing out the next good packet whenever there were skips and the previous callback was not serviced using a prediction. This PR takes a slightly different approach by allowing us to stash and use the next good packet on the following callback. This also helps slow down jumping sequence numbers when there are multiple skipped packets in a row (which causes abrupt drops in latency). This also addresses a special case where we are only skipping a single good packet due to tolerance. Rather than returning a prediction, we allow it to use the packet. For this to work, we need to ease the tolerance restrictions slightly by allowing it to sometimes expand by the duration of an additional packet. Effectively, this also means that tolerance restrictions alone will only cause glitches when the skew exceeds at least one packet in duration. My initial testing indicates that these changes significantly reduce glitch counts, by as much as 2x, resulting in a slightly improved signal (at least to my ears). sudo tc qdisc add dev eth0 root netem slot distribution pareto 0.1ms 3.0ms loss 10% This also eliminates the use of "goto" statements in the regulator code Includes a fix for building libsamplerate with cmake 4.x Includes a CI fix for installing pkgconfiglite on Windows
mikedickey
added a commit
that referenced
this pull request
Jan 29, 2026
This builds upon the refinement introduced by: #1437 That PR allowed us to use a good packet ignoring skips if the previous callback was serviced using a prediction (glitch). However, we were still effectively throwing out the next good packet whenever there were skips and the previous callback was not serviced using a prediction. This PR takes a slightly different approach by allowing us to stash and use the next good packet on the following callback. This also helps slow down jumping sequence numbers when there are multiple skipped packets in a row (which causes abrupt drops in latency). This also addresses a special case where we are only skipping a single good packet due to tolerance. Rather than returning a prediction, we allow it to use the packet. For this to work, we need to ease the tolerance restrictions slightly by allowing it to sometimes expand by the duration of an additional packet. Effectively, this also means that tolerance restrictions alone will only cause glitches when the skew exceeds at least one packet in duration. My initial testing indicates that these changes significantly reduce glitch counts, by as much as 2x, resulting in a slightly improved signal (at least to my ears). sudo tc qdisc add dev eth0 root netem slot distribution pareto 0.1ms 3.0ms loss 10% This also eliminates the use of "goto" statements in the regulator code and fixes a bug with auto headroom adjustments
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.
If the previous call returned a predicted result (glitch), and we have a good packet available, don't process it as a glitch.
Updated changelog for 2.7.0-beta2 release