On Sun, 24 Mar 2002, Paul Davis wrote:

> 
> >Actually, one more question that I couldn't answer from the API docs:
> >What do you have to do to recover from -EPIPE in the case when the
> >hardware doesn't stop (i.e., when stop_threshold == UINT_MAX)?  Do you
> >just retry the write, or is there some call needed to clear the xrun?
> 
> the primary purpose of using UINT_MAX is to avoid the driver itself
> taking action on your behalf. it allows the application to know about
> xruns when they happen, and handle them accordingly. however, there
> isn't really very much you can do except to stop the stream, prepare
> it, and restart it. you failed to keep up, and that means a restart is
> in order. i think.
> 

Well, if I am running capture and playback channels in sync, I certainly
don't want to restart the capture channel (and destroy my recording) in the
case when the playback buffer under-runs. Keep in mind I have a very short
buffer for playback (to keep latency down) but a long buffer for capture.
What I want to happen is to get a momentary silence in the playback channel,
but have it recover "in sync" with the capture channel (this was the subject
of a previous question I asked on the list, to which Jaroslav's answer was
to set stop_threshold high so the playback channel would never stop).

Now, what I would like the driver to do in this case is to just carry on
as if nothing had happened (outputting garbage) until my program "catches up"
with the sound card. That is, ideally the "tail" pointer of the queue would
be allowed to pass the "head" pointer, allowing the "length" of the queue to
become increasingly negative, and writes would not block until the queue
was once again full. There was some indication that this might actually happen,
since the API doc for snd_status_get_delay says that the "delay" (which I
interpret to be the length of the queue in frames) is negative in the case
of a playback under-run. Of course I have no idea...

        Ken


_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to