Non-optimal default settings for codec and chunk_ms?
mill1000 opened this issue · comments
The default codec=flac
and chunk_ms=20
seem to be a non-optimal configuration. The comments in the configuration even indicates FLAC needs a larger chunk size.
snapcast/server/etc/snapserver.conf
Lines 144 to 150 in 8d282c5
Some codecs have a higher latency and will need more data, e.g. Flac will need ~26ms chunks
In my testing, the default configuration causes occasional audible glitches with the following printed on the client
Feb 03 15:19:31 StereoBerry snapclient[30155]: pBuffer->full() && (abs(median_) > 2): 2282
Feb 03 15:19:38 StereoBerry snapclient[30155]: pBuffer->full() && (abs(median_) > 2): 2099
Feb 03 15:19:43 StereoBerry snapclient[30155]: pBuffer->full() && (abs(median_) > 2): 2701
Feb 03 15:19:54 StereoBerry snapclient[30155]: pBuffer->full() && (abs(median_) > 2): 2270
Feb 03 15:19:59 StereoBerry snapclient[30155]: pBuffer->full() && (abs(median_) > 2): 2569
Bumping chunk size of 40 seems to help.
These dropouts were likely due to my ALSA configuration and not snapcast.
How did you change your alsa config?
In my case I had an ALSA config that duplicated the stream, fed one into a dmix device and the other into a virtual loopback device. I simplified it into a single dmix device and the issues went away.
Please re-open this issue, maybe with edited intro post to make clear from the beginning, that your problem had another cause. This issue is still valid indeed, since it's still an error that the default setting for flac is chunk_ms=20 while the explaining text in the config files says FLAC needs at least 26 ms.