osxaudio: Fix deadlock and property change notification in device selection code
authorSebastian Dröge <sebastian@centricular.com>
Mon, 22 Dec 2014 09:23:01 +0000 (10:23 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 22 Dec 2014 09:29:01 +0000 (10:29 +0100)
commite7b10a107d7a255f658c8acb07f7e5e7968dfd66
treeb1b65a77441138daee38f4f6b90ca2cd8d2104eb
parent2a1459c88fefc6d27cb5b3282efa2179902512cd
osxaudio: Fix deadlock and property change notification in device selection code

After creating the ringbuffer we have to set the device on the ringbuffer as
it defaults to kAudioDeviceUnknown. At this point it can't have changed to
anything else yet and we don't have to notify about changes to the sink/src
"device" property. It's also not a good idea because GstAudioBaseSrc has the
object lock taken while the ringbuffer is created, which might cause a
deadlock if something calls back into the element from "notify::device".

Once the base class is done with the NULL_TO_READY state change, it has opened
the device via the ringbuffer and this might have chosen a different device.
Especially if we initially used kAudioDeviceUnknown. Also notify about this
property change as initially intended by this code.
sys/osxaudio/gstosxaudiosink.c
sys/osxaudio/gstosxaudiosrc.c