From 0b5f71652668e7c4f9304c5a190fd84136f23117 Mon Sep 17 00:00:00 2001 From: Vlad Pruteanu Date: Tue, 28 May 2024 16:42:08 +0300 Subject: [PATCH] bluez5: bap: Support Mono Channel Allocation The Bluetooth SIG Assigned Numbers Document has been updated and a value of 0 for the Channel Allocation is now allowed, with the meaning of "Mono". --- spa/plugins/bluez5/bap-codec-caps.h | 2 +- spa/plugins/bluez5/bap-codec-lc3.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spa/plugins/bluez5/bap-codec-caps.h b/spa/plugins/bluez5/bap-codec-caps.h index 3588f3efd..981b0015d 100644 --- a/spa/plugins/bluez5/bap-codec-caps.h +++ b/spa/plugins/bluez5/bap-codec-caps.h @@ -53,7 +53,7 @@ #define LC3_MAX_CHANNELS 28 -#define BAP_CHANNEL_NOT_ALLOWED 0x00000000 +#define BAP_CHANNEL_MONO 0x00000000 /* mono */ #define BAP_CHANNEL_FL 0x00000001 /* front left */ #define BAP_CHANNEL_FR 0x00000002 /* front right */ #define BAP_CHANNEL_FC 0x00000004 /* front center */ diff --git a/spa/plugins/bluez5/bap-codec-lc3.c b/spa/plugins/bluez5/bap-codec-lc3.c index dece5927f..f628bd481 100644 --- a/spa/plugins/bluez5/bap-codec-lc3.c +++ b/spa/plugins/bluez5/bap-codec-lc3.c @@ -74,6 +74,7 @@ static const struct { uint32_t bit; enum spa_audio_channel channel; } channel_bits[] = { + { BAP_CHANNEL_MONO, SPA_AUDIO_CHANNEL_MONO }, { BAP_CHANNEL_FL, SPA_AUDIO_CHANNEL_FL }, { BAP_CHANNEL_FR, SPA_AUDIO_CHANNEL_FR }, { BAP_CHANNEL_FC, SPA_AUDIO_CHANNEL_FC }, @@ -1170,7 +1171,7 @@ static int codec_get_bis_config(const struct media_codec *codec, uint8_t *caps, } } - if ((preset == NULL) || (channel_allocation == 0)) + if (preset == NULL) return -EINVAL; SPA_FOR_EACH_ELEMENT_VAR(bap_bcast_qos_configs, c) {