audio priority and multitasking on iOS
audio priority and multitasking on iOS
- Subject: audio priority and multitasking on iOS
- From: Niels Bogaards <email@hidden>
- Date: Mon, 29 Nov 2010 20:33:58 +0100
Hi,
I use RemoteIO to playback sound on the iPhone. What I noticed
recently, is that I get dropouts when my app is in the foreground,
but other apps run in the background. I was assuming that the
coreaudio remoteio thread was about the highest priority on iOS, and
that playback of audio would be safe, regardless of other apps'
activity. Is that true, or is there some way to renice it to become
even higher priority?
Since noticing the dropouts, I've closely analysed my callback's
behaviour and the overall app performance. Even in the simplest of
scenarios (filling the callback's buffer by a square wave) I get some
dropouts. My real callback however is much heavier, even though it
never surpasses 15% CPU in total. I could try to move most of the
processing out of the callback (and into other async threads), but I
fear it will not completely irradicate the dropouts. No way to know
but trying it, so I have some performance related questions:
- my callback does some reading via AVAssetReader's
copyNextSampleBuffer. Is this a no-go in the callback? If so, what
would be the preferred approach; reading (very) much in advance on a
normal thread (like the main thread), or create/hook into another
high priority thread like the quicktime thread (and would that thread
still run when the app is in the background?).
- I use an NSLock tryLock in the callback. Is this ok? would a
pthread mutex/condition be better?
- I use vDSP in the callback. Is that ok? Are there compiler flags I
should set to have optimal vDSP performance?
- is there a way to monitor the amount of CPU available for the app
(so I can just refuse to start the audio when the background apps
take too much) ?
- would there be a difference in performance between 8.24 fixed point
(that I use now) and 16-bit integer for the RemoteIO callback?
- I run quite intensive CoreGraphics at the same time. Am I wrong to
assume that the audio thread would always get priority over the
graphics?
Thanks for your time and input,
Niels
_______________________________________________
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