[Jack-Devel] Why frame sizes are limited to the powers of 2?

Filipe Coelho falktx at gmail.com
Wed Jul 26 09:35:11 CEST 2017


On 26.07.2017 08:58, Yuri wrote:
> jack_set_buffer_size limits frame size to the powers of 2.
>
> The Opus codec (http://opus-codec.org/) doesn't like such frame sizes. 
> It defines frame sizes in milliseconds, and allows 5 ms, 10 ms, 20 ms, 
> 25 ms, ... which in case of 48,000 sample rate are never a power of two.
>
> It seems like Jack shouldn't be so strict in limiting frame rates to 
> the powers of 2.
>
>
> How to solve this problem?

Hi.

Which exact version of jack are you using?

afaik this depends on the driver and soundcard used.
I just tried here with latest jack2 using alsa hdmi output, I can use 
1024 buffer size as usual, but also a few non-power-of-2 values as well.

falktx at falkTX-PC:~$ jack_bufsize
buffer size = 1024  sample rate = 48000

falktx at falkTX-PC:~$ jack_bufsize 1000
jack_set_buffer_size(): Unknown error -1

falktx at falkTX-PC:~$ jack_bufsize 800

falktx at falkTX-PC:~$ jack_bufsize 802
jack_set_buffer_size(): Unknown error -1

falktx at falkTX-PC:~$ jack_bufsize 870
jack_set_buffer_size(): Unknown error -1

falktx at falkTX-PC:~$ jack_bufsize 880


So some of those buffer sizes work, some do not.
GUIs usually show only power of 2 values because they're safer to use (I 
mean, more likely to actually work).
Also some jack applications sadly were made with the expectation that 
power-of-2 buffer sizes will be used...
But for such cases the application can return an error on start and 
during the jack-buffersize-callback, to force jack to be under 
power-of-2 sizes.

Anyway, at least in latest jack2 this is not a problem.
Not sure about jack1, but I believe the same is true.




More information about the Jackaudio mailing list