Hi,
I have written streaming radio application which uses the AudioUnit for playback. My application is crashing randomly(once in 50 times or so) during AUGraph cleanup process.
I could not see any document from apple what API sequence should be used to cleanup the AUGraph. I have looked at the iOS Audio Unit Sample codes, Most of the code does not use any cleanup method. few code uses only DisposeAUGraph.
Here is the API Sequence i am following to clean up the AUGraph
AUGraphStop() => Check if AUGraphIsRunning before call this method
AUGraphUninitialize() => Check of AUGraph IsInitialized before call this method
AUGraphClose()
DisposeAUGraph()
Here is the crash Log from crashlytics
2 Crashed: com.vikkrithik.indradio
EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0xc0000004
Thread 2: Crashed: com.vikkrithik.indradio
0 AudioToolbox 0x2e11e5fc AURemoteIO::~AURemoteIO() + 711
1 AudioToolbox 0x2e11e583 AURemoteIO::~AURemoteIO() + 590
2 AudioToolbox 0x2e049427 ComponentBase::AP_Close(void*) + 102
3 AudioToolbox 0x2e0492ad APComponentInstance::DisposeInstance() + 88
4 AudioToolbox 0x2e1ced27 AudioUnitNodeInfo::Close() + 22
5 AudioToolbox 0x2e1cc011 AUGraphClose + 80
6 INDRadio 0x001b01b1 -[JPStreamAudioPlayer closeAUGraph] + 22764
7 INDRadio 0x001afa4d -[JPStreamAudioPlayer cleanupAudioPlayBuffer] + 20872
8 INDRadio 0x001aeb17 __27-[JPStreamAudioPlayer play]_block_invoke + 16978
9 libdispatch.dylib 0x38fb20c3 _dispatch_call_block_and_release + 10
10 libdispatch.dylib 0x38fb6e7b _dispatch_queue_drain + 374
11 libdispatch.dylib 0x38fb3f93 _dispatch_queue_invoke + 42
12 libdispatch.dylib 0x38fb7745 _dispatch_root_queue_drain + 76
13 libdispatch.dylib 0x38fb79c5 _dispatch_worker_thread2 + 56
14 libsystem_pthread.dylib 0x390e1dff _pthread_wqthread + 298
CloseAUGraph is method which handles the AUGraph clean up.
I dont see any memory leak in instruments if i don't call closeAUGraph method.
Is AUGraph clean up mandatory?
What sequence should be called to clean up the AUGraph?
What condition should be validated before each cleanup API call?
Any help in this regard greatly appreciated.
Thank you
Sasikumar JP