• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: AURemoteIO::Initialize failed: -12985 on iOS 5
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: AURemoteIO::Initialize failed: -12985 on iOS 5


  • Subject: RE: AURemoteIO::Initialize failed: -12985 on iOS 5
  • From: email@hidden
  • Date: Mon, 09 Jan 2012 13:07:44 +1300
  • Thread-topic: AURemoteIO::Initialize failed: -12985 on iOS 5

I think that this has been determined to be “works as intended”. When you get an interruption-ended callback, your application might still be sufficiently backgrounded that it doesn’t have permission to restart audio playback. You just need to wait a little while and try again. There are two things to watch here though:

1)       On some 4.x versions of iOS, AudioOutputUnitStart failing in this way resulted in the RemoteIO device getting borked every so often (it would “start” but never call the render callback). Doing a complete teardown/startup of the audio unit was required to get things working properly. I haven’t done enough testing of iOS 5 to see if it’s an issue there though.

2)       Related to the above – if you destroy a RemoteIO unit then try to create it again straight away, you can run in to the same “starts but never calls the callback” issue. The threshold appears to be somewhere in the 10-20 millisecond range, but an order of magnitude safety margin is probably a good idea (and usually not an issue).

 

Also, you don’t want to do AudioSessionSetActive(FALSE) when getting interrupted. This can make some things unhappy IIRC. The AudioSessionSetActive(TRUE) at the end of an interruption is I think required – there is no guarantee that your audio session has automatically been reactivated.

 

 

Cheers,

Michael


From: coreaudio-api-bounces+michael.brown=email@hidden [mailto:coreaudio-api-bounces+michael.brown=email@hidden] On Behalf Of Paul Scott
Sent: Monday, 9 January 2012 8:49 a.m.
To: CoreAudio API
Subject: AURemoteIO::Initialize failed: -12985 on iOS 5

 

I'm using a Remote I/O unit with a render callback, that is working perfectly in all circumstances except one, which I'll describe shortly.

 

I've implemented an interruption listener as follows:

 

    switch ( inInterruptionState ) {

        case kAudioSessionBeginInterruption:

            AudioOutputUnitStop( aUnit );

            break;

        case kAudioSessionEndInterruption:

            rampUpVolume = 0.0;

            AudioOutputUnitStart( aUnit );  //  <--- FAILS ONLY IN BACKGROUND

            break;

    }

 

Now on iOS 5, in all cases of interruption except one, the audio stops playing in case kAudioSessionBeginInterruption and begins playing again in case kAudioSessionEndInterruption. However,  when the app is playing in background, it does not begin playing again for case kAudioSessionEndInterruption because the AudioOutputUnitStart( aUnit ) fails with the following error reported on gdb console:

 

2012-01-08 11:27:36.267 MyBackGApp[7942:707] 11:27:36.265 <0x3ef07ce8> AUIOClient_StartIO failed (-12985)

 

If instead, I teardown and startup of the audio unit with code that distills down to this:

 

    switch ( inInterruptionState ) {

        case kAudioSessionBeginInterruption:

            AudioOutputUnitStop( aUnit );

            AudioUnitUninitialize( aUnit );

            AudioComponentInstanceDispose( aUnit );

            AudioSessionSetActive( false );

            aUnit = nil;

            break;

        case kAudioSessionEndInterruption:

            AudioSessionSetActive( true );

            AudioComponentDescription defaultOutputDescription;

            defaultOutputDescription.componentType = kAudioUnitType_Output;

            defaultOutputDescription.componentSubType = kAudioUnitSubType_RemoteIO;

            defaultOutputDescription.componentManufacturer = kAudioUnitManufacturer_Apple;

            defaultOutputDescription.componentFlags = 0;

            defaultOutputDescription.componentFlagsMask = 0;

            AudioComponent defaultOutput = AudioComponentFindNext( NULL, &defaultOutputDescription );

            AudioComponentInstanceNew( defaultOutput, &aUnit );

            AURenderCallbackStruct input;

            input.inputProc = RenderAudio;

            input.inputProcRefCon = self;

            AudioUnitSetProperty( aUnit, kAudioUnitProperty_SetRenderCallback, 

                kAudioUnitScope_Input, 0, &input, sizeof(input) );

            int bytes_per_float = sizeof (Float32);

            int bits_per_byte = 8;

            AudioStreamBasicDescription streamFormat;

            streamFormat.mSampleRate = 8000;

            streamFormat.mFormatID = kAudioFormatLinearPCM;

            streamFormat.mFormatFlags = kAudioFormatFlagsNativeFloatPacked | kAudioFormatFlagIsNonInterleaved;

            streamFormat.mFramesPerPacket = 1; 

            streamFormat.mChannelsPerFrame = 1;

            streamFormat.mBytesPerFrame = streamFormat.mChannelsPerFrame * bytes_per_float;           

            streamFormat.mBytesPerPacket = streamFormat.mBytesPerFrame;

            streamFormat.mBitsPerChannel = bytes_per_float * bits_per_byte;

            streamFormat.mReserved = 0;

            AudioUnitSetProperty ( aUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input,

                0, &streamFormat, sizeof(AudioStreamBasicDescription) );

            rampUpVolume = 0.0;

            rampUpVolumeRate = 2.0 / streamFormat.mSampleRate;

            AudioUnitInitialize( aUnit );  //  <--- FAILS ONLY IN BACKGROUND

            AudioOutputUnitStart( aUnit );

            break;

    }

 

Then the AudioUnitInitialize( aUnit ) fails, but again only when in background, with the following error reported on gdb console:

 

2012-01-08 10:16:25.095 MyBackGApp[7838:707] 10:16:25.096 <0x3ef07ce8> AURemoteIO::Initialize failed: -12985 (enable 2, outf< 1 ch,   8000 Hz, Float32> inf< 2 ch,      0 Hz, Float32, non-inter>)

 

I can find no documentation at all for -- and no header file containing -- the error -12985.

 

What is the reason for this error? How can I avoid it so that my app begins playing again in background, after the interruption?

 

Thanks!

Paul

 

--

Paul Scott

email@hidden

 

 _______________________________________________
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

  • Follow-Ups:
    • Re: AURemoteIO::Initialize failed: -12985 on iOS 5
      • From: Paul Scott <email@hidden>
References: 
 >AURemoteIO::Initialize failed: -12985 on iOS 5 (From: Paul Scott <email@hidden>)

  • Prev by Date: AURemoteIO::Initialize failed: -12985 on iOS 5
  • Next by Date: Re: AURemoteIO::Initialize failed: -12985 on iOS 5
  • Previous by thread: AURemoteIO::Initialize failed: -12985 on iOS 5
  • Next by thread: Re: AURemoteIO::Initialize failed: -12985 on iOS 5
  • Index(es):
    • Date
    • Thread