[alsa-devel] more on appl_ptr and DMA overrun at end of stream

Jon Smirl jonsmirl at gmail.com
Thu May 21 20:44:27 CEST 2009


I've been reading Lennart's article on glitch free audio....

On my scatter/gather DMA hardware I generate an interrupt at the end
of each period. On the last period this causes ALSA to issue a
trigger(STOP). However, there is a latency from when that interrupt is
generated and when ALSA does the trigger(STOP). During that latency my
hardware starts playing the next buffer (which contains stale data).
Playing stale data causes a noise burst. I fixed this by programming
my DMA hardware to not overrun appl_ptr.

There's another solution. ALSA already knows the stream ends
mid-period and pads out the partial period with silence. If it simply
padded out the next period with silence too the overrun problem would
become non-audible and there would time to process trigger(STOP).

If padding out two periods at end of stream is possible, it then
becomes possible for me to turn off interrupts in my audio driver.

-- 
Jon Smirl
jonsmirl at gmail.com


More information about the Alsa-devel mailing list