• 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
Crash on AudioRouteKey Compare
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Crash on AudioRouteKey Compare


  • Subject: Crash on AudioRouteKey Compare
  • From: Alexandru Gologan <email@hidden>
  • Date: Wed, 14 Aug 2013 16:58:09 +0300

Hi,

I'm seeing a crash that I have no reproduction steps for and I'm wandering if I'm missing something in code.
I want to check if headphones have been disconnected so I add a listener to audio route change.

AudioSessionAddPropertyListener(kAudioSessionProperty_AudioRouteChange, sessionPropertyListener, (__bridge void *)(self))

And than in the session property listener I check if I had headphones connected when kAudioSessionRouteChangeReason_OldDeviceUnavailable like so:

CFDictionaryRef previousRouteDescription = CFDictionaryGetValue(dict, kAudioSession_AudioRouteChangeKey_PreviousRouteDescription);

        CFArrayRef outputs = CFDictionaryGetValue(previousRouteDescription, kAudioSession_AudioRouteKey_Outputs);

        CFIndex count = CFArrayGetCount(outputs);

for (int i = 0; i < count; ++i) {

            CFDictionaryRef outputDesc = CFArrayGetValueAtIndex(outputs, i);

            CFStringRef outputRoute = CFDictionaryGetValue(outputDesc, kAudioSession_AudioRouteKey_Type);

            if (kCFCompareEqualTo == CFStringCompare(outputRoute, kAudioSessionOutputRoute_Headphones, 0)) {

                hadHeadphones = YES;

            }

        }




The crash I'm seeing is on CFStringCompare and it crashes with EXC_BAD_ACCESS and code: KERN_INVALID_ADDRESS at 0x0
That would mean that in some scenarios the outputRoute is NULL. I can do a proper check to be certain I don't run in any further issues but I'd like to understand when the error might happen in the code I wrote.

Regards,
Alexandru
 _______________________________________________
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: Crash on AudioRouteKey Compare
      • From: Kevin Dixon <email@hidden>
  • Prev by Date: Re: AVAssetReader crashing under 10.8.2
  • Next by Date: handlepitchwheel in auinstrument
  • Previous by thread: Re: AVAssetReader crashing under 10.8.2
  • Next by thread: Re: Crash on AudioRouteKey Compare
  • Index(es):
    • Date
    • Thread