- 
                Notifications
    
You must be signed in to change notification settings  - Fork 8.2k
 
Closed
Labels
EnhancementChanges/Updates/Additions to existing featuresChanges/Updates/Additions to existing featuresGood first issueGood for a first time contributor to takeGood for a first time contributor to takearea: Bluetootharea: Bluetooth Audio
Description
Is your enhancement proposal related to a problem? Please describe.
In LE audio, the channel or location values (enum bt_audio_location) are bitfields.
When decoding an SDU, which may have multiple frames per frame block, it's a good idea for the receiver to verify the frame block to see if it matches the number of channels for the stream.
Describe the solution you'd like
Implement a function bt_audio_get_chan_count that takes an enum bt_audio_location and returns the number of channels in that value.
The implementation would be something like
uint8_t bt_audio_get_chan_count(enum bt_audio_location chan_allocation)
{
	uint8_t cnt = 0U;
	if (chan_allocation == BT_AUDIO_LOCATION_MONO_AUDIO) {
		return 1;
	}
	while (chan_allocation != 0) {
		cnt += chan_allocation & 1U;
		chan_allocation >>= 1;
	}
	return cnt;
}Describe alternatives you've considered
N/A
Additional context
N/A
Metadata
Metadata
Assignees
Labels
EnhancementChanges/Updates/Additions to existing featuresChanges/Updates/Additions to existing featuresGood first issueGood for a first time contributor to takeGood for a first time contributor to takearea: Bluetootharea: Bluetooth Audio
Type
Projects
Status
Done