mozilla / cubeb-coreaudio-rs

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

Use default channel layout if layout have non silent duplicate channels #117

Closed ChunMinChang closed 3 years ago

ChunMinChang commented 3 years ago

This solves the BMO 1675719.

The channel layout set in the output device might have non silent duplicate channels (e.g., having two Front-Right in the channels), which is not a valid case of our audio mixer usages. It will lead to a panic in our code. The Audio MIDI Setup on MacOS disallows setting duplicate channels within a channel layout. It will throw a "Overlapping Channels" error in that case. It implies that the "overlapping channels" setting is not defined by the user. It's likely to be defined in the firmware instead. Since the user doesn't ask it explicitly, it's not necessary to accept this kind of layout that is forbidden on Mac OS by default.

When there are duplicate non-silent channel in the output channel layout, we can ignore this invalid channel layout and apply a standard SMPTE layout instead.