Of course it is possible that there is systematic difference in stream time vs global pulse audio clock.
The analysis and discussion in https://gitlab.winehq.org/wine/wine/-/merge_requests/10792 suggests that this is an actual issue. I could not ever really reproduce it in full myself but the time may drift indeed. At least with real pulseaudio server and not pipewire-pulse the buffer usage can grow, maybe not necessarily due to different time source but it looks like occasional delays in PA (e. g., due to heavy load) may push stream time back a bit and the timeline never catches up, and if it hits buffer overflow the pa_held_bytes is not reset, buffer stays full and causes constant audio clicking. PA has a possibility of syncing streams on the same device (by providing master stream to pa_stream_connect), that could in theory be helpful here. I explored that a bit but in the end it doesn't look feasible to use: * not sure if it is doing anything at all on pipewire pulse, none of the listed constraints seem to take place (e. g., I can connect streams from different devices using the same master stream); * that is supported for render streams only; * on pulseaudio server when streams are on default device (empty name) that happens to prevent audio from switching device when default device is switched in settings; * solvable, but the synced streams can only be corked and resumed together, so if a single stream is paused it would have to stay running with silence. So I went a different way, assumed that there is no reason for the steams to have systematic time difference on the same PA device, started only grouping streams from the same device (or default device) in the same period and reintroduced timeline adjustment logic which is currently present. I also changed what happens in pulse_release_render_buffer() in case of 'pa_held_bytes' overflow: made it reset pa_held_bytes bytes to held_bytes so if for whatever reason a stream overflows over long run it can recover instead of getting stuck in the bad state with no spare output space. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8628#note_139156