Note that there are some explanatory texts on larger screens.

plurals
  1. POReceiving kAUGraphErr_CannotDoInCurrentContext
    primarykey
    data
    text
    <p>The line <code>AudioDeviceManager *manager = (__bridge AudioDeviceManager *)inRefCon;</code> is causing an EXC_BAD_ACCESS (code 1). The actual error is AudioUnitRender Failed: Unknown (-10863), which translates into kAUGraphErr_CannotDoInCurrentContext.</p> <p>Here's the callback where it's happening:</p> <pre><code>static OSStatus playbackCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) { int i, j; if(startedCallback &amp;&amp; noInterrupt) { //get a copy of the objectiveC class "self" AudioDeviceManager *manager = (__bridge AudioDeviceManager *)inRefCon; //data from input; 16 bit integer, one channel short signed int * source= (short signed int *)bufferList-&gt;mBuffers[0].mData; inNumberFrames= inNumberFrames&lt;1025?inNumberFrames:1024; //pre created data stores float * inputbuf = manager-&gt;inputbuf; // shift old audio data memmove(inputbuf, inputbuf+inNumberFrames, sizeof(float)*(1024-inNumberFrames)); for (j = 0; j &lt; inNumberFrames; j++) { inputbuf[j+1024-inNumberFrames] = source[j]*3.0518509475997e-05f; //conversion from 16 bit integer (range up to 32767 either side of 0.0) to float (-1.0 to 1.0) } manager-&gt;seq_cb(inputbuf, NULL, inNumberFrames, inTimeStamp, manager-&gt;seq); //loop through all the buffers that need to be filled ( in practice, will be one) for (i = 0 ; i &lt; ioData-&gt;mNumberBuffers; i++){ //get the buffer to be filled AudioBuffer buffer = ioData-&gt;mBuffers[i]; //printf("which buf %d numberOfSamples %d channels %d countertest %d \n", i, buffer.mDataByteSize, buffer.mNumberChannels, g_countertest); //if needed we can get the number of bytes that will fill the buffer using // int numberOfSamples = ioData-&gt;mBuffers[i].mDataByteSize; //get the buffer and point to it as an UInt32 (as we will be filling it with 32 bit samples) //if we wanted we could grab it as a 16 bit and put in the samples for left and right seperately //but the loop below would be for(j = 0; j &lt; inNumberFrames * 2; j++) as each frame is a 32 bit number //UInt32 *frameBuffer = buffer.mData; short signed int *frameBuffer = (short signed int *)buffer.mData; //loop through the buffer and fill the frames for (j = 0; j &lt; inNumberFrames; j++){ //interleaved stereo, left then right frameBuffer[2*j] = 0; //mono output; later could have stereo effects frameBuffer[2*j+1] = 0; //++g_countertest; } } } else { //output zeroes while not ready to process input for (i = 0 ; i &lt; ioData-&gt;mNumberBuffers; i++){ AudioBuffer buffer = ioData-&gt;mBuffers[i]; short signed int *frameBuffer = (short signed int *)buffer.mData; //loop through the buffer and fill the frames for (j = 0; j &lt; inNumberFrames; j++){ short signed int value = 0; //32767.0*0.0; frameBuffer[2*j] = value; frameBuffer[2*j+1] = value; //++g_countertest; } } } return noErr; } </code></pre> <p>I've found <a href="https://stackoverflow.com/questions/7354964/intermittent-crash-in-recordingcallback-on-app-launch">this</a>, which is a similar situation. The <a href="http://developer.apple.com/library/ios/#documentation/AudioToolbox/Reference/AUGraphServicesReference/Reference/reference.html#//apple_ref/doc/uid/TP40007289" rel="nofollow noreferrer">documentation</a> just says </p> <blockquote> <p>you can generally attempt the action again - typically the NEXT render cycle</p> </blockquote> <p>but every time the callback gets called the same exception is raised.</p> <p>Stack trace:</p> <pre><code>Thread 6 name: AURemoteIO::IOThread Thread 6 Crashed: 0 libobjc.A.dylib 0x317bcf7a objc_retain + 10 1 Partyscape 0x0006cb36 _ZL16playbackCallbackPvPmPK14AudioTimeStampmmP15AudioBufferList (AudioDeviceManager.mm:80) 2 AudioToolbox 0x366a5326 AUInputElement::PullInput(unsigned long&amp;, AudioTimeStamp const&amp;, unsigned long, unsigned long) + 130 3 AudioToolbox 0x366aa6f6 AUInputFormatConverter2::InputProc(OpaqueAudioConverter*, unsigned long*, AudioBufferList*, AudioStreamPacketDescription**, void*) + 154 4 AudioToolbox 0x3668f31e AudioConverterChain::CallInputProc(unsigned long) + 354 5 AudioToolbox 0x3668f074 AudioConverterChain::FillBufferFromInputProc(unsigned long*, CABufferList*) + 72 6 AudioToolbox 0x3668f01e BufferedAudioConverter::GetInputBytes(unsigned long, unsigned long&amp;, CABufferList const*&amp;) + 122 7 AudioToolbox 0x366aa5c2 CBRConverter::RenderOutput(CABufferList*, unsigned long, unsigned long&amp;, AudioStreamPacketDescription*) + 74 8 AudioToolbox 0x3668ed4c BufferedAudioConverter::FillBuffer(unsigned long&amp;, AudioBufferList&amp;, AudioStreamPacketDescription*) + 180 9 AudioToolbox 0x3668ee92 AudioConverterChain::RenderOutput(CABufferList*, unsigned long, unsigned long&amp;, AudioStreamPacketDescription*) + 86 10 AudioToolbox 0x3668ed4c BufferedAudioConverter::FillBuffer(unsigned long&amp;, AudioBufferList&amp;, AudioStreamPacketDescription*) + 180 11 AudioToolbox 0x3668eb22 AudioConverterFillComplexBuffer + 350 12 AudioToolbox 0x367549b0 AUInputFormatConverter2::PullAndConvertInput(AudioTimeStamp const&amp;, unsigned long&amp;, AudioBufferList&amp;, AudioStreamPacketDescription*, bool&amp;) + 104 13 AudioToolbox 0x366aa518 AUConverterBase::RenderBus(unsigned long&amp;, AudioTimeStamp const&amp;, unsigned long, unsigned long) + 896 14 AudioToolbox 0x36745376 AURemoteIO::RenderBus(unsigned long&amp;, AudioTimeStamp const&amp;, unsigned long, unsigned long) + 42 15 AudioToolbox 0x36757d84 AUBase::DoRenderBus(unsigned long&amp;, AudioTimeStamp const&amp;, unsigned long, AUOutputElement*, unsigned long, AudioBufferList&amp;) + 184 16 AudioToolbox 0x3669002e AUBase::DoRender(unsigned long&amp;, AudioTimeStamp const&amp;, unsigned long, unsigned long, AudioBufferList&amp;) + 438 17 AudioToolbox 0x3674592a AURemoteIO::PerformIO(unsigned int, unsigned int, XAudioTimeStamp const&amp;, XAudioTimeStamp const&amp;, int&amp;) + 870 18 AudioToolbox 0x36745a90 AURIOCallbackReceiver_PerformIO + 192 19 AudioToolbox 0x3673ca1e _XPerformIO + 178 20 AudioToolbox 0x366a5cdc mshMIGPerform + 368 21 AudioToolbox 0x36710b96 MSHMIGDispatchMessage + 22 22 AudioToolbox 0x367452ea AURemoteIO::IOThread::Run() + 58 23 AudioToolbox 0x36748f42 AURemoteIO::IOThread::Entry(void*) + 2 24 AudioToolbox 0x36685c9c CAPThread::Entry(CAPThread*) + 208 25 libsystem_c.dylib 0x3414172e _pthread_start + 314 26 libsystem_c.dylib 0x341415e8 thread_start + 0 </code></pre> <p>In fact there <em>is</em> another AURemoteIO thread, and it looks like this:</p> <pre><code>Thread 9 name: AURemoteIO::IOThread Thread 9: 0 libsystem_kernel.dylib 0x382dd004 mach_msg_trap + 20 1 libsystem_kernel.dylib 0x382dd1fa mach_msg + 50 2 AudioToolbox 0x36745312 AURemoteIO::IOThread::Run() + 98 3 AudioToolbox 0x36748f42 AURemoteIO::IOThread::Entry(void*) + 2 4 AudioToolbox 0x36685c9c CAPThread::Entry(CAPThread*) + 208 5 libsystem_c.dylib 0x3414172e _pthread_start + 314 6 libsystem_c.dylib 0x341415e8 thread_start + 0 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload