Skip to content

fix/layered replace and pacer follow ups - #29

Merged
dangusev merged 8 commits into
fix/flush-and-rtp-timeline-follow-upsfrom
fix/layered-replace-and-pacer-follow-ups
Oct 13, 2026
Merged

dangusev merged 8 commits into
fix/flush-and-rtp-timeline-follow-upsfrom
fix/layered-replace-and-pacer-follow-ups

Conversation

@dangusev

Copy link
Copy Markdown
Collaborator

Stack created with GitHub Stacks CLI • Give Feedback 💬

@dangusev
dangusev added this pull request to stack #31 October 13, 2026 14:22
@dangusev
dangusev force-pushed the fix/layered-replace-and-pacer-follow-ups branch 2 times, most recently from ce2f836 to 8c86e0c Compare October 13, 2026 14:54
Since 349ec42 the error also covers a replace by a track with other layers, so the old name was wrong. The variant is not released yet.
flush gave the filter reset to the holder of the resampler lock, but only a write that had not yet checked the flush count did the reset. When the pacer held the lock, or a write held it after its check, up to 8 ms of old audio stayed in the filter and could play. The resampler mutex now also holds the flush count of the audio in the filter. A write resets a stale filter before it pushes, take_pcm takes the tail only when the count is current, and flush no longer locks the resampler.
At the end of the hold, start_audio_pacing called start_pacing, which set pacing_enabled. A pause_pacing made before publish_audio or during the hold was lost, and the queued audio played. pacing_enabled now starts as true and records only the user pause, and start_audio_pacing starts the pacer task without changing it. A track that the user did not pause still starts pacing at the first SFU publisher connect, with pace on or off.
RtpTimeline took its first sequence number and timestamp from a wall-clock value with fewer than 16 bits of entropy, so the first timestamp was always below 65536. RFC 3550 says these values should be random. random_u32 now takes them from a version 4 UUID, which uses the random source of the operating system. uuid is already a dependency.
The default interceptors of webrtc-rs 0.17.2 include a NACK responder, which sends a lost packet again on the media SSRC. Only RTX is missing.
The first tick after a write never takes the resampler audio, so the test passed with no flush check. It now takes a second tick, which fails when take_pcm plays the audio from before the flush.
@dangusev
dangusev force-pushed the fix/layered-replace-and-pacer-follow-ups branch from 8c86e0c to aea5e88 Compare October 13, 2026 15:02
@dangusev
dangusev merged commit b92bc04 into main Oct 13, 2026
6 of 11 checks passed
@dangusev
dangusev deleted the fix/layered-replace-and-pacer-follow-ups branch October 13, 2026 15:39
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