the crash about audio unit start?

I have an ios app about communicate audio and video. the Voice communication part use audio unit. there are two obj obj_audiounit ,one is use to record (voip),another is use to play audio (voip).and the audio unit obj of play,crash !!!.

at the play part , i use a thread to start the audio unit . but it crash random.


thread run{

OSStatus status = AudioUnitInitialize(pThis->m_pAudioUnit);

if (status != noErr)

{

NSLog(@"couldn't initialize AURemoteIO instance");

}

status = AudioOutputUnitStart(pThis->m_pAudioUnit);

if (status != noErr)

{

NSLog(@"error AudioOutputUnitStart");

}

}


libembeddsystemaus.dylib aumethodstart+160876 (void*)+64

libembeddsystemaus.dylib aumethodstart+160856(void*)+44

libsystem_pthread _pthread_start


thread X crash with arm thread state....


what's the reason?

Replies

Shared variables are accessed by each thread.the start fun use so much time ,before audiounitstart achieved ,call the audiounitstop and set it nil