On 10/24/2011 06:34 PM, Pierre-Louis Bossart wrote:
You want to avoid rewinding completely. Your audio hardware might have prefetched data with the DMA subsystem. Rewinding completely might result in an inconsistent configuration and possibly underflows. If you look at the PulseAudio code, we've introduced some thresholds beyond which we don't rewind (128 bytes or 1ms off the top of my head). You might argue that snd_pcm_rewindable is broken, but it's somewhat difficult to fix as the amount of prefetched data isn't modeled in the driver and it's very much hardware-specific. Using a less aggressive approach works fine on most hardware. -Pierre
Yes, I figured this out while experimenting with real hw alsa devices and that's why I actually rewind snd_pcm_rewindable() minus some threshold, that can be configured. However with the alsa pulseaudio plugin, rewinding seems to be broken completely, even with a very large threshold.