mozilla / cubeb-coreaudio-rs

The audio backend of Firefox on Mac OS X.
ISC License
25 stars 10 forks source link

Skip listener-removed assertion if aggregate device is dead #114

Closed ChunMinChang closed 4 years ago

ChunMinChang commented 4 years ago

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.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1658982