For some time, our audio app crashed when an audio device was plugged in (or when Facetime was connecting). Strangely, this only happened when the app was built on OS X 10.7 or later and run on 10.7 or later. That is, the 10.6 built app (which we distributed) didn't crash on any version of OS X and the 10.7-up built version didn't crash on 10.6.

The backtrace would typically look like

Thread 7 Crashed:: Dispatch queue: com.apple.audio.CADispatchQueue.SerialQueue
0
1       -- application exception handler here --
2 com.apple.audio.CoreAudio 0x99ddcd42 HALObject::PropertiesChanged(unsigned long, AudioObjectPropertyAddress const*) + 714 3 com.apple.audio.CoreAudio 0x99de11d8 HALSystem::ObjectsPublishedAndDied(unsigned long, unsigned long const*, unsigned long, unsigned long const*) + 1242 4 com.apple.audio.CoreAudio 0x99de1553 HALSystem::AudioObjectsPublishedAndDied(AudioHardwarePlugInInterface**, unsigned long, unsigned long, unsigned long const*, unsigned long, unsigned long const*) + 187 5 com.apple.audio.CoreAudio 0x99dcf101 HALC_ShellPlugIn::ProxyObject_PropertiesChanged(unsigned long, unsigned long, AudioObjectPropertyAddress const*) + 787 6 com.apple.audio.CoreAudio 0x99dbdc00 HALC_ProxyNotifications::CallListener(unsigned long, unsigned long, unsigned long, AudioObjectPropertyAddress const*) + 56
7   com.apple.audio.CoreAudio           0x99da97ed 
HALC_ProxyNotifications::CallListener_f(void*) + 41
8   libdispatch.dylib                   0x93cbe130 _dispatch_client_callout + 50
9   libdispatch.dylib                   0x93cc1d05 _dispatch_queue_drain + 1017
10  libdispatch.dylib                   0x93cc399d _dispatch_queue_invoke + 186
11  libdispatch.dylib                   0x93cc0f89 _dispatch_root_queue_drain + 
395
12  libdispatch.dylib                   0x93cd063d _dispatch_worker_thread3 + 97
13  libsystem_pthread.dylib             0x914c5653 _pthread_wqthread + 724
14  libsystem_pthread.dylib             0x914c2e0e start_wqthread + 30

Finally, we found out that not calling GetDefaultOutputVolume at application startup, resolved the issue. No more crashes on plugging in audio devices.

I did some low-level debugging. Even on OS X 10.6 (where it doesn't crash), GetDefaultOutputVolume calls

AudioObjectAddPropertyListener 3x
AudioObjectRemovePropertyListener 0x

AudioHardwareAddPropertyListener 3x
AudioHardwareRemovePropertyListener 2x

AudioDeviceAddPropertyListener 10x
AudioDeviceRemovePropertyListener 8x

The crash backtrace suggests that an invalid property listener is getting called when the input or output device list gets changed. And the above list suggests that not all installed property listeners are being removed by GetDefaultOutputVolume. Unless there is some unknown logic behind this that I am not aware of. Can you shed some light on this ?

Regards,

Adriaan van Os
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to