audiosource
audiosource copied to clipboard
Audio skipping
Audio seems to come and go and the sound is just non-stop skipping, like so

Fixed by changing
PIPE_SIZE = 4096
BUF_SIZE = 1024 # Must be less than PIPE_BUF = 4096 for atomic writes.
in the audiosource script to
PIPE_SIZE = 5120
BUF_SIZE = 2048 # Must be less than PIPE_BUF = 4096 for atomic writes.
Hi! The problem still exists in the script from master branch. It was fixed with the following values in my case:
F_SETPIPE_SZ = 2062 PIPE_SIZE = 16384 BUF_SIZE = 4096
@defaultpage F_SETPIPE_SZ is the operation ID when calling fcntl(2) so it should not be changed.
Increasing BUF_SIZE make it so the Python script can write 4096 bytes in a single iteration instead of 4 (if Python is too slow). Increasing PIPE_SIZE allows for more room if the consumer and the producer are not called consistently (due to scheduling for instance). The tradeoff here is increased latency.
This issue may appear on a busy / slow system. If you can sustain the stream for some time without any audio skips, then I could make these values configurable directly through the environment. I could also set a higher scheduling priority (but that requires root privileges).