[BUG?] Setting (start_threshold > stop_threshold) makes snd_pcm_writei(a_small_buffer) XRUN immediately
Zhang Boyang
zhangboyang.id at gmail.com
Fri Oct 1 19:31:12 CEST 2021
Hello,
I'm using ALSA to develop an audio-streaming application. I try to
use start_threshold and stop_threshold in combination with small
buffers. However, I think I probably found a bug about this.
I'm setting start_threshold=100 and stop_threshold=50. I'm also using
a buffer of 44 frames. When I call
snd_pcm_writei(the_small_44_frames_buffer), pcm state came to XRUN from
PREPARED directly. I think this is a bug because the stream hasn't
started. It's hard to say a xrun occurred while stream not started.
I'm wondering if this is a ALSA-bug or a misuse of ALSA. A simple bug
test program is attached.
Thank you very much!
Zhang Boyang
p.s.
I dug into kernel code. After writting hardware buffer,
__snd_pcm_lib_xfer() called snd_pcm_update_state(), which set the XRUN
state.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: start_stop_threshold_bug.c
Type: text/x-csrc
Size: 4494 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20211002/4057c614/attachment.bin>
More information about the Alsa-devel
mailing list