iOS AudioUnit callback thread slows down while transitioning to background mode

Hello

I'm writing an application to play RTP audio stream on iOS devices. It works well on both foreground and background modes, but while switching to background it kind of stuck for about a second. Trying to investigate that issue, i found what during transition to background mode, time between calls of AudioUnit callback function rises from 5 milliseconds up to 100 milliseconds, and when transition is finished - falls back to 5 milliseconds.

AVAudioSession category is AVAudioSessionCategoryPlayback. CPU load never goes higher than 10%. What am i doing wrong, and how to fix it?

Replies

This seems to be the expected behavior. Callback buffer sizes and timing are not guaranteed to be fixed, but can vary, depending on what the OS is doing.