[pulseaudio-discuss] PulseAudio null sink monitor gives distorted audio randomly
Alexander E. Patrakov
patrakov at gmail.com
Thu Nov 8 16:31:52 UTC 2018
[resending to the list, really this time]
On 11/8/18 7:44 PM, Tanu Kaskinen wrote:
> The problem is most likely due to this bug regarding monitor sources:
> https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/304
>
> Whenever the monitored sink has a rewind, a chunk of audio is
> apparently duplicated in the monitor source. It would be great if
> someone could figure out what goes wrong in the monitor rewinding code.
Let me quote the main mistake, from src/pulse/stream.h:
> * The latency is stored in \a *r_usec. In case the stream is a
> * monitoring stream the result can be negative, i.e. the captured
> * samples are not yet played. In this case \a *negative is set to 1.
I.e., the design mistake is that monitor sources allow one to capture
samples that have not yet been played. This is always wrong, as those
samples can be overwritten by a rewind, and there is no "uncapture" to
compensate. So the fix would be to make sure that monitor sources
capture not what was just written to them, but what was actually played
and can no longer be overwritten. I.e., change the latency from negative
to small positive.
--
Alexander e. Patrakov
More information about the pulseaudio-discuss
mailing list