[Openal-devel] al_mixer _alMicroSleep issue
Panne Sven BenQ MD PBM IPM TPS 4
sven.panne at siemens.com
Fri Nov 4 01:46:40 PST 2005
It was me who made the change you've mentioned, because something had to be done to ensure that _alExit() doesn't hang. The basic problem here is that the locking/threading code in the Linux SI is, well, a bit adventurous at least... The concrete problem here is that async_mixer_iterate() can eat up *all* CPU time, without giving other threads a chance to run. The only case when that "works" is when the underlying OS has a scheduling stratgegy which is not completely unfair. Relying on a scheduling behaviour is in general poor coding practice and obviously didn't work well in the past (the well-known problem that OpenAL hung when it was about to be exited). The _alMicroSleep(1) is admittedly a workaround only, because I didn't want to redesign the threading part at that time. What's quite puzzling for me is the fact that this short sleep causes problems for you, perhaps one mixer iteration doesn't produce enough data for your case. Hmmm, one workaround for the workaround mig!
ht be to do the short sleep only every nth iteration and play around with n until it works for you. Ugly, but this might be the quickest way. Could you try this, please?
I don't have enough time currently to really fix the mixer threading issues, is there somebody out there who wants to tackle this problem?
Cheers,
S.
> -----Original Message-----
> From: openal-devel-admin at opensource.creative.com
> [mailto:openal-devel-admin at opensource.creative.com] On Behalf
> Of Pigeon
> Sent: Donnerstag, 3. November 2005 21:25
> To: openal-devel at opensource.creative.com
> Subject: [Openal-devel] al_mixer _alMicroSleep issue
> [...] I've just discovered an issue with openal cvs. I found
> out this problem when I was running FlightGear, ALSA 1.0.9b
> drivers, Linux 2.4.28 SMP kernel (P4 HT).
>
> Any sound will give a crackling noise. Then I went
> through the test in openal and alut, and found out I got the
> same problem when running linux/test/testlistener [...]
> diff -u -r1.19 -r1.20
> --- linux/src/al_mixer.c 21 Aug 2005 08:28:19 -0000 1.19
> +++ linux/src/al_mixer.c 18 Sep 2005 12:29:59 -0000 1.20
> @@ -1113,6 +1113,8 @@
>
> _alUnlockMixerPause();
> }
> + /* give other threads a chance to acquire the mixer lock */
> + _alMicroSleep(1);
> } while(time_for_mixer_to_die == AL_FALSE);
>
> time_for_mixer_to_die = AL_FALSE;
> [...]
More information about the Openal-devel
mailing list