Hello,
I would like to discuss the desired behaviour for suspend/resume
cycles for the PCM interface. The actual implementation of PM in ALSA
drivers silently assumes that the application doesn't handle anything and
the PCM stream continues with the time gap. It doesn't look bad until the
application is real-time related. The question is, if we should define a
new PCM state 'SUSPEND' which behaves like XRUN but it's not guaranteed
that all samples from ring buffer are drained for playback (capture should
behave like standard overrun). The actual position can be determined, so
the application can choose, if the data would be lost or resent them
again. We can eventually implement a new RESUME syscall which will resume
playback after next 'write' call or capture before next 'read' call.
So the power management write loop should be:
res = snd_pcm_write(pcm, data, size);
if (res == -ESTRPIPE) { /* SUSPEND */
err = snd_pcm_resume(pcm);
if (err == -ENXIO) /* not implemented */
err = snd_pcm_prepare(pcm);
if (err < 0)
/* report error */ ;
} else if (res == -EPIPE) { /* underrun */
err = snd_pcm_prepare(pcm);
if (err < 0)
/* report error */ ;
}
Any comments, suggestions, other ideas?
Jaroslav
-----
Jaroslav Kysela <[EMAIL PROTECTED]>
SuSE Linux http://www.suse.com
ALSA project http://www.alsa-project.org
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel