This patch works around a crash we get in BMO 1658982 [1].
When creating the aggregate device, somehow we will get
kAudioHardwareBadObjectError error during set_sub_devices_sync step.
This error occurs when removing the device-changed listeners for the
newly created aggregate device. This error implies the aggregate device
is somehow dead. In this case, it's ok to not remove the listener
manually since the listener should receive nothing from a dead device.
We can just return error to indicate the aggregate device isn't
initialized successfully.
We should return the error if sub devices cannot be set. However, this
patch only return the error when timeout of setting the sub devices. The
reason to do so is to investigate when kAudioHardwareBadObjectError is
thrown.
This patch works around a crash we get in BMO 1658982 [1].
When creating the aggregate device, somehow we will get
kAudioHardwareBadObjectError
error duringset_sub_devices_sync
step. This error occurs when removing the device-changed listeners for the newly created aggregate device. This error implies the aggregate device is somehow dead. In this case, it's ok to not remove the listener manually since the listener should receive nothing from a dead device. We can just return error to indicate the aggregate device isn't initialized successfully.We should return the error if sub devices cannot be set. However, this patch only return the error when timeout of setting the sub devices. The reason to do so is to investigate when
kAudioHardwareBadObjectError
is thrown.[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1658982