On 01/09/2018 08:33 AM, Takashi Iwai wrote: [...]
However, the problem is that OSS emulation sets avail_min=1: implying that, when there is any samples empty in the ring buffer, it can continue. In the case above, when some samples have been processed before wait_for_avail(), it keeps the outer loop spinning again.
Since each iteration takes ca 2ms on my VM, 8000Hz rate gives 1 or 2 samples free at each iteration. Thus at each time snd_pcm_lib_xfer() is invoked, it processes 1 or 2 samples, then returns due to pending signals, and the outer loop continues until the whole given samples are consumed. If the machine is faster or the sample rate is lower, the outer loop may exit, OTOH.
OK, that makes sense. I didn't think about that case. In my mind I was working with avail_min=period_size.
Thanks for clearing this up.
- Lars