[Clam-devel] Re: [Portaudio] Xruns using alsa api

David García Garzón dgarcia at iua.upf.edu
Thu Mar 15 01:42:29 PDT 2007

On Dimecres 14 Març 2007, Arve Knudsen wrote:
> Hi David
> On Mon, 12 Mar 2007 20:27:02 +0100, David García Garzón
> <dgarcia at iua.upf.edu> wrote:
> > Hi, all.
> >
> > We are trying to use Portaudio as the default audio backend for CLAM. We
> > already used it on Windows and got some xruns depending on the machine,
> > but
> > for Linux we got a lot of continuous xruns either by using OSS api (not
> > reported to the callback but heard) and Alsa api (reported and heard). I
> > tested it in several Kubuntu machines. And got the same bad results.
> >
> > Such xruns don't happen neither by using directly JACK or by using Alsa
> > in
> > blocking mode. For direct Alsa, we gave some priority to the audio
> > thread.
> > Maybe that could be the trick but firstly i don't know how the proper
> > way of
> > bumping the portaudio callback priority, and, secondly it is strange for
> > me
> > that portaudio doesn't work well as is.
> >
> > I am missing something? Any clues?
> It is simply possible that this is down to bottlenecks in the PA ALSA
> layer; it always worked alright for my purposes, but people have reported
> less than perfect performance from time to time. I have done some tweaking
> of the implementation in the past, but I don't see myself making major
> improvements to PA ALSA -- professional obligations must receive priority
> and I don't do any audio-related development these days. I can assist,
> however, in making sense of the code if some brave soul were to try and
> improve on it.

I already solved the main xrun problem by boosting the audio thread priority 
the first time the callback is called after starting the stream. I sent on a 
previous mail the code i used (win32+posix). Putting that code on the 
callback is akward. Doing such boost within Portaudio could be more smart. Is 
it convenient? which could be the convenient way to let the user controlling 

While boosting priority removed continuous short xruns i was getting on every 
PC, now i still get long intermitent audio halts on a specific model of HP 
desktop and when i try to use input and output at the time. This seems to be 
something related to the poor support of our audio card in linux and the 
duplex mode. But i have to investigate further.

David García Garzón
(Work) dgarcia at iua dot upf anotherdot es
(Home) vokimon at telefonica adot net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20070315/7c01c0bd/attachment.sig>

More information about the clam-devel mailing list