[alsa-devel] How to report error in _pointer function?
Takashi Iwai
tiwai at suse.de
Wed Jul 30 18:12:43 CEST 2008
At Wed, 30 Jul 2008 10:56:31 -0500,
Timur Tabi wrote:
>
> In my driver, I can detect in the _pointer callback function whether
> or not the DMA engine has actually started. Sometimes, when I have a
> programming error, the DMA will not start, so my _pointer function
> calculates a crazy value for the current position. The number it
> returns causes ALSA to go haywire (see my post titled, "underrun!!!
> (at least 1786051083.613 ms long)".
>
> What is the best way to handle this? Is there a way I can tell ALSA,
> "hey, this is really screwed up, just abort playback and return an
> error to the app"?
You can return SNDRV_PCM_POS_XRUN from the pointer callback (with
kernel messages if you like). Then the PCM stream is stopped and the
status is changed to SND_PCM_STATUS_XRUN. Further access will result
in -EPIPE.
I guess this doesn't fully satisfy your demand, but maybe better than
now :) We'd need a mechanism to pass a proper error code if other
critical error code must be passed.
Takashi
More information about the Alsa-devel
mailing list