Clemens Ladisch wrote:
Timur Tabi wrote:
It turns out that ALSA (when using mplayer to play a divx video file via OSS emulation) is rapidly sending back-to-back SNDRV_PCM_TRIGGER_STOP and SNDRV_PCM_TRIGGER_START commands. Why would it do that?
To recover from underruns.
I've added some function traces to ALSA, and apparently ALSA is telling the driver to STOP when the driver calls snd_pcm_period_elapsed(). Here's a log:
snd_pcm_period_elapsed snd_pcm_update_hw_ptr_interrupt:232 <- last line of this function PERIOD <- printk in the driver's ISR snd_pcm_period_elapsed snd_pcm_update_hw_ptr_interrupt:232 snd_pcm_update_hw_ptr_post xrun snd_pcm_stop snd_pcm_action snd_pcm_action_single snd_pcm_do_stop STOP 279 <- command to stop after sub-buffer #279, which is at the end of the period
Unfortunately, very little of the code in sound/core/pcm???.c is documented, so I'm having a hard time figuring out what's going on. Why is ALSA telling the driver to stop during a period interrupt?