Re: [AD] Alsa driver hogs CPU

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sun, 2003-12-21 at 17:37, Thomas Fjellstrom wrote:

> I currently don't have any sound problems besides the rather low quality of my 
> via82xx chip's output ;) I did however notice some odd problems when using 
> ALSA ~1.0 (be it a beta release or recent 0.9.* release...), I ended up 
> downgrading to ALSA 0.9.4 to rid my self of some problems when in conjunction 
> with MythTV... (audio stuttering, etc...) Mind you 1.0 rc2 seems to be "ok" 
> on my main machine...
> 
> Do any alsa programs work? Do any show the same problems? Maybe I missed 
> something in the ALSA non-manual. (there isn't one really... pita) Or they 
> changed the api since I wrote the driver (AGAIN).
> 

No, other ALSA programs work (and use <1% CPU while playing music). Also
Allegro sound works, just it uses so much CPU. I believe, the problem is
somehow in how the background thread and alsa_update work together.
Probably we should wait until someone shows up who knows how this part
of Allegro is supposed to work.

I've looked a bit at the code, and it seems like background functions
(like alsa_update) are called 100 times / second:

at least, src/unix/uthreads.c bg_man_pthreads_threadfunc contains:
delay.tv_sec = 0;
delay.tv_usec = 10000;
select(0, NULL, NULL, NULL, &delay);

And the callbacks should then return as fast as possible I guess. But I
didn't look very long. What are the fragments and the loop inside
alsa_update for? And I believe the sleep(1) in there better not get
executed - since it blocks other background callbacks?

-- 
Elias Pschernig <elias@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/