Re: Core Audio thread priority
Re: Core Audio thread priority
- Subject: Re: Core Audio thread priority
- From: "B.J. Buchalter" <email@hidden>
- Date: Thu, 14 Oct 2010 23:23:49 -0400
On Oct 14, 2010, at 10:46 PM, Evan Olcott wrote:
> Just exploring an angle here - a user (and frequent poster here whom I respect greatly) gave us a tip with regards to the CoreAudio thread running in a desktop application, but just looking for some clarification/insight...
>
> Is there any benefit to modifying the CoreAudio thread's priority after the launch of an application?
>
> Let me snip a bit from our conversation:
> -----
> As far as I recall, audio playback with CoreAudio has always required that application developers modify their own thread priority to be real-time fixed, rather than the usual degrading priority that programs get. When I say "CoreAudio thread" I really just mean the thread within your application that handles audio. You certainly have a separate thread for audio, apart from the GUI thread. My experience is that setting the proper thread priority not only gets rid of glitches, but it actually lowers the CPU usage of an audio application.
> -----
>
> In all my years working in CoreAudio, I've never come across this documented anywhere or given as an example in sample code. Can someone clarify if this is actually true, and if so, how to take advantage of this?
>
The thread that the IOProc runs on is already set to time constrained thread priority. You don't need to mess with its priority, and doing so will probably cause problems.
If you have other threads that feed audio to the IOProc or process audio from the IOProc and feed it back to the IOProc, they will generally benefit from you adjusting their thread priority so that they don't get stomped by high priority threads in the WindowServer but you have to be a little careful to not set the priority too high, or do too much work, or you could starve the IOProc thread or time-critical threads in the kernel (for example Audio Driver threads).
Best regards,
B.J. Buchalter
Metric Halo
http://www.mhlabs.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden