On Wed May 6 13:02:13 2026 +0000, Dzmitry Keremsha wrote:
I have done extensive testing in the past few days and here are my observations: 1. No drift whatsoever with a virtual sink after an hour of logging. 2. The timer math looks correct and there are no truncation errors, mmdev usec is 10000. It might be possible that pulse is consuming based on the soundcard clock which could be at 47999 sample rate instead of 48000, in which case overfill is unavoidable even with a perfect timer. One way to solve this would be a dynamic resampler, which did seem to work in my testing, does not affect held_bytes and is absolutely unnoticeable. What do you think about this idea? Can't we somehow tie our timer to the soundcard clock? I mean, instead of using a fixed offset to calculate the wait time, can we base it on the actual rate of consumption by PA?
Something similar is done in `dlls/dmsynth/synthsink.c`, which uses DirectSound position notifications to to get a precise playback position and then extrapolates it to calculate the wait time. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10792#note_138986