AudioChannelLayout.mChannelLayoutTag has different value in iOS 12

On iOS 11, trying to retrieve the kAudioUnitProperty_AudioChannelLayout property returns different information than iOS 12:


On iOS 11, AudioChannelLayout.mChannelLayoutTag returns kAudioChannelLayoutTag_UseChannelDescriptions

On iOS 12, AudioChannelLayout.mChannelLayoutTag returns 6619138


This is on an iPhone 7 plus and iOS 12 beta 4.


Is this expected? If so, it seems to conflict with some open source projects like GStreamer that only supports kAudioChannelLayoutTag_UseChannelDescriptions.

Replies

Channel layout tag 6619138 is kAudioChannelLayoutTag_Stereo, which effectively means the same thing as kAudioChannelLayoutTag_UseChannelDescriptions with a pair of channel descriptions.


While I'm not familiar with the long term history of channel tags, it was probably never safe to assume that a particular channel tag would always be returned.


I recommend that you file an iOS 12 bug report against this issue, describing the change in observed behavior. The workaround would be to not rely on a particular channel tag to specify the channel layout.

Thank you very much for the quick reply Polyphonic! I have submitted rdar://42746101. I have also posted on the GStreamer forums to see their thoughts. Unfortunately we are just an app that relies on GStreamer for streaming.

@Polyphonic - How would you recommend dynamically figuring out how many channels are in a particular kAudioChannelLayoutTag (and also the associated kAudioChannelLabel's)? Previously, UseChannelDescriptions allowed us to easily support a wide range of layouts. However, the only option I see now is to hardcode the mapping for each kAudioChannelLayoutTag. Is that correct? How would we be able to handle new tags that may appear in future iOS versions? Also, is there a current list of the tags that may be returned in iOS? For example, I expected kAudioChannelLayoutTag_StereoHeadphones to be returned when I plugged in headphones but that wasn't the case.


Thanks in advance!

There's actually a function for getting the number of channels:


https://developer.apple.com/documentation/coreaudio/1422032-audiochannellayouttag_getnumbero


>> is there a current list of the tags that may be returned in iOS?


I don't know of one. It would be unwise to rely on such a list, though. You've already discovered that the tags for system devices may vary across OS versions (and of course may vary across devices).

Ah that's perfect! Is there a similar method to get the array of AudioChannelLabel's for the Layout? I couldn't find one but maybe I'm looking in the wrong place.

No, the only case where you'll find AudioChannelLabels is when the channel layout tag is kAudioChannelLayoutTag_UseChannelDescriptions. In all other cases, you'll have to deduce the label from the meaning of the tag.