Audio Unit callbacks pause during audio route change (iOS 5.1)
Audio Unit callbacks pause during audio route change (iOS 5.1)
- Subject: Audio Unit callbacks pause during audio route change (iOS 5.1)
- From: Thomas Leavy <email@hidden>
- Date: Sun, 22 Jul 2012 02:22:25 -0400
I am coding a VoIP app using audio units but I am rather confused about a little glitch I have discovered. If the user say hits the speakerphone button on my app (audio route change to speaker) or plugs in their headphones both the recording and playback callbacks don't fire for a certain amount of time.
After many tests I've noticed when changing audio route I lose 4000 samples of time 1/2 second and when plugging in headphones about 1/4 second is lost. This wouldn't normally be that big of a deal but I am writing data to a socket in the record callback and reading audio from a buffer in the playback callback. When someone hits the speaker button audio is not sent or played which causes that amount of lag on their playback as well as a situation where the person they are talking to thinks they lost packets.
It would be one thing if the next callback accounted for the lost time by requesting more frames of playback or providing more frames of recording but it pretends nothing happened? Is there something I'm missing here? For instance if I keep hitting the route change button the call totally dies because the record callback doesn't fire therefor sending no packets in the call and the other client thinks the connection dropped.
The audio route change is called from the main thread is that an issue? The networking layer and obviously the audio unit are on separate threads I've tested it by checking the inTimestamp value on the callbacks. It increments by 128 samples every time except after you call the audio route override to speaker. The next callback is 4000+ samples later although it is only requesting 128 samples or playing back 128 samples.
Any help would be extremely appreciated.
Thanks in advance this mailing list has been a life saver so far!
Thomas Leavy
IT and Networking Consultant
_______________________________________________
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