Repository navigation
Pin sendspin-cpp to 90cbd808 and stamp audio on the client clock - #94
Merged
Merged
Conversation
sendspin-cpp #208 moves the library's clock to CLOCK_MONOTONIC_RAW on Linux, so an NTP slew no longer drags the measured server offset. Every timestamp we hand it -- notify_audio_played() from the sinks, write_audio() from the sources -- must be on that clock too, so each backend now reads SendspinClient::now_us() instead of its own steady_clock helper. The PipeWire source translated pw_time::now as if it were ours; it now carries that reading's age on CLOCK_MONOTONIC across instead. Pinned to the commit until v0.10.0 is tagged.
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.
Why
sendspin-cpp #208 reads the host clock from
CLOCK_MONOTONIC_RAWon Linux.steady_clockthere isCLOCK_MONOTONIC, which NTP slews, so while the time daemon corrects the system clock the measured server offset moves faster than the time filter follows and playback hard-corrects. aiosendspin already timestamps on the raw clock.That change only helps if the timestamps we hand the library are on the same clock. Ours were not: every backend stamped
notify_audio_played()andwrite_audio()from its ownsteady_clockhelper. Bumping the pin alone would have put the two in different domains, which drift apart with every slew.What
SENDSPIN_GIT_TAGto90cbd808(the #208 merge), as Move to sendspin-cpp rc1: encryption on, unpaired access opt-in #72 did before v0.9.5. Re-pin to v0.10.0 once it is tagged.now_us()and reads the library's staticSendspinClient::now_us(). All of them already stamp as "now ± a latency the backend measured", so only the base changes.pw_time::nowas an absolute time on our clock. It now measures that reading's age onCLOCK_MONOTONICand carries it onto the client clock, the way the CoreAudio backends carrymHostTimeacross.macOS is unchanged in behaviour: the library keeps
steady_clockoff Linux.Deadlines, timeouts and scheduling still use
steady_clock; they never reach the library.Testing
-DSENDSPIN_CLI_WERROR=ON: builds clean, 540/540 tests pass.--versionreportssendspin-cpp 90cbd808….scripts/format.sh --checkwith clang-format 20.1.8.Known gap, from upstream: with
-o pulsethe player can still lose sync after such a correction, because PulseAudio's own timing runs onCLOCK_MONOTONIC.