9 Sep
2014
9 Sep
'14
10:43 a.m.
Alexander E. Patrakov wrote:
|---------|---------P----h----p---------|-a-------|---------|
So, what should alsa-lib return for snd_pcm_avail() and snd_pcm_rewind()? The driver only knows that "P" is already used, can infer that "p" isn't used yet, and knows nothing about samples in the middle.
Indeed. However, the DMA pointer moves asynchronously, so it is possible that it has already moved beyond p when snd_pcm_rewindable() returns. For the samples between P and p, the risk is larger than for those after p, but p is not a boundary where the risk abruptly decreases.
It would make sense to report the pointer update granularity, but not to adjust the return value of snd_pcm_avail/rewindable().
Regards, Clemens