Skip to content

Comments

Don't glitch on the first good packet if previous was a glitch#1437

Merged
mikedickey merged 1 commit intodevfrom
bugfix/plc-fewer-glitches
Jun 26, 2025
Merged

Don't glitch on the first good packet if previous was a glitch#1437
mikedickey merged 1 commit intodevfrom
bugfix/plc-fewer-glitches

Conversation

@mikedickey
Copy link
Collaborator

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

@mikedickey mikedickey requested a review from cchafe June 26, 2025 16:09
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
Copy link
Collaborator

@cchafe cchafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huge win!
tested vs. current dev branch and in the overrun case it outperforms amazingly

@mikedickey mikedickey merged commit 002cb03 into dev Jun 26, 2025
20 of 21 checks passed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants