mozilla / cubeb-coreaudio-rs

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

Bail out in `activate_clock_drift_compensation` if no enough sub devices #118

Closed ChunMinChang closed 3 years ago

ChunMinChang commented 3 years ago

This works around the crash in BMO 1677766.

It's not clear why the number of the owning sub-devices in the created aggregate device is less than 2, after setting sub devices from input and output sides via AggregateDevice::set_sub_devices_sync. The sub-devices should be set synchronously when the above function is called. Maybe kAudioObjectPropertyOwnedObjects is not synchronous or symmetric to kAudioAggregateDevicePropertyFullSubDeviceList, which is the property set in AggregateDevice::set_sub_devices_sync.

If the sub devices are less than 2 (we should have at least one input and one output) in AggregateDevice::activate_clock_drift_compensation, the AggregateDevice::new should bail out with an error returned. Then the cubeb stream can follow the fallback mechanism to create a duplex stream without using an aggregate-device.