Repository navigation
fix/pacer and resampler follow ups - #25
Merged
dangusev merged 10 commits intoOct 13, 2026
Merged
Conversation
dangusev
added this pull request to stack #31
October 13, 2026 14:22
dangusev
force-pushed
the
fix/pacer-and-resampler-follow-ups
branch
from
October 13, 2026 14:54
3e61d8c to
78e8818
Compare
dangusev
force-pushed
the
fix/pacer-and-resampler-follow-ups
branch
from
October 13, 2026 14:54
3e61d8c to
78e8818
Compare
The sinc filter blocked a runtime worker for about 130 ms for a 30 s write at 24 kHz, and the pacer waited on the resampler lock for that time. write_pcm now resamples in spawn_blocking, as write_i420 does for video. take_pcm uses try_lock, so the pacer does not wait for a write and takes no resampler audio during it.
The pacer flushed the resampler at each tick with less than one frame in the queue, also between the writes of a continuous stream. The first tick after the first write always found a short queue. Each flush made the next write start with 128 input frames of silence, an 11 ms gap at 16 kHz. take_pcm now flushes only when no write_pcm came since the last tick, so the end of an utterance still plays.
write_pcm started the pacer with start_pacing, which also enabled pacing, so an earlier pause_pacing was lost. pacing_enabled now starts as the pace setting, and write_pcm only starts the pacer task. The user pause (pacing_enabled) and the publication hold (held) stay separate.
With pace on, the first write_pcm started the pacer, and its first tick came at once. Before Call::publish_audio, the track had no sender, so the pacer sent the audio nowhere (webrtc-rs returns Ok(0)). The publication hold started too late to keep it. write_pcm now starts the pacer only when a negotiated PeerConnection can send the track.
A new track on a kept sender continued from the timestamp that the stopped track had at the stop, and a paused or held pacer did not advance the clock. The RTCP sender reports advance with the wall clock, so the next packet and the reports disagreed. continue_rtp_from now adds the time since the stop, for audio and video, and a paused or held tick advances the clock by 20 ms, as a muted tick does.
dangusev
force-pushed
the
fix/pacer-and-resampler-follow-ups
branch
from
October 13, 2026 15:02
78e8818 to
d4ceaba
Compare
aliev
approved these changes
Oct 13, 2026
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.
Stack created with GitHub Stacks CLI • Give Feedback 💬