Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 5952

snd_pcm_wait timeout with USB driver and certain buffer sizes

$
0
0

I'm testing audio playback using ALSA on Ubuntu 22.04, using USB audio devices that I think use the USB class audio driver.I've found that for certain ranges of buffer size, snd_pcm_wait() always times out.Two example buffer sizes are 1024 (512 period x2) and 2048 (1024 period x2) at 48000hzThey are ranges as opposed to specific values, but they are quite narrow, e.g. the behavior is the same from 998 to 1028.At 96000hz, the problematic buffer sizes are twice the size of those at 48000hz.If I don't wait or wait for a small timeout (i.e. period size) instead of a large one (e.g. 1 second), it still times out but the audio streaming works nonetheless as snd_pcm_avail_update() correctly reports samples being available. This workaround is however not ideal and results in slightly higher cpu usage.

Maybe I'm not setting some configuration parameter correctly, however it works well at buffer sizes outside of those ranges. I'm using the period size for snd_pcm_sw_params_set_avail_min().Note that it's not a buffer/period size thing, it works at much smaller as well as bigger buffer/period sizes.

This problem seems to be specific to the USB driver, doesn't happen with the "default" virtual driver or with the built-in audio device.

Thanks for any help.


Viewing all articles
Browse latest Browse all 5952

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>