[alsa-devel] [PATCH - ALSA JACK plugin 1/1] jack: Only allow ALSA periods multiple of JACKd period

Takashi Iwai tiwai at suse.de
Thu Jul 19 20:42:12 CEST 2018


On Thu, 19 Jul 2018 09:50:09 +0200,
<twischer at de.adit-jv.com> wrote:
> 
> From: Laxmi Devi <ldevi at de.adit-jv.com>
> 
> There is a higher Xrun probability whenever the ALSA period is not a
> multiple of the JACKd period and the ALSA buffer is only twice the period.
> Allowing ALSA buffers of min. 3x period is not a good solution because this
> would increase the latency.
> 
> As an example in case of ALSA is using a period of 11 frames and JACK a
> period of 12 frames and a buffer of 22 frames (2x ALSA period) is used:
> - The buffer is filled and contains 22 frames
> - JACK is reading 12 frames. Buffer is only containing 10 frames
> - Now, ALSA has to be scheduled exactly after the last JACK read and
>   before the next read. Otherwise we will get an Xrun
> In case of ALSA is using a multiple period of JACK, JACK can always read
> 2 periods before an Xrun if the buffer was full.
> 
> In case of ALSA is using a period of 12 frames and JACK a period of 11
> frames and a buffer of 24 frames (2x ALSA period) is used:
> - The buffer is filled and contains 24 frames
> - JACK is reading 11 frames. Buffer is now containing 13 frames. But ALSA
>   can still not write to the buffer
> - JACK reads 11 additional frames. Buffer contains 2 frames
> - Now, ALSA has to be scheduled exactly after the last JACK read and
>   before the next read. Otherwise we will get an Xrun
> In case of ALSA is using a multiple period of JACK, ALSA can always write
> to the buffer as long as the buffer is filled with less or equal of half
> of buffer.
> 
> Therefore this patch enforces an ALSA period which is always a multiple
> of the JACKd period.
> 
> Signed-off-by: Laxmi Devi <ldevi at de.adit-jv.com>
> Signed-off-by: Timo Wischer <twischer at de.adit-jv.com>

Applied now.  Thanks.


Takashi


More information about the Alsa-devel mailing list