[alsa-devel] mono/stereo translation & number of frames per period

Paul Stone metabagel at icloud.com
Wed Apr 5 04:21:05 CEST 2017


If my driver reports channels_min of '1', then the following command produces silence rather than the expected tone. Maybe, there is a problem due to the nonstandard frequency of 16 kHz?

# speaker-test -D plughw:3,0 -c1 -r16000 -l4 -t wav -w ~/1kmono.wav

After rewriting my driver to support having only a single channel, I found that I have to be very careful about the parameters I provide in the hardware definition, otherwise ALSA will tend to ask for a copy operation outside of the bounds of my buffer space. This surprises me, because I'm providing the size of the buffer with the buffer_bytes_max.

The buffer overrun in the copy doesn't happen all the time, and my ALSA is pretty old, so I thought maybe my ALSA has a race condition, and sometimes doesn't reset to the start of the buffer for the copy. The immediate prior pointer callback returned zero, so it seems like the problem is ALSA's. I modified my copy function to detect this situation and position to the start of the buffer, and it seems to work better now.
-Paul Stone


More information about the Alsa-devel mailing list