Bluetooth: Audio: Add BAP broadcast sink support

Add support for the BAP broadcast sink role. This role
allows a device to sync to a broadcast ISO stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2022-01-10 15:34:37 +01:00 committed by Johan Hedberg
commit cf06fa85f2
6 changed files with 1087 additions and 4 deletions

View file

@ -51,8 +51,13 @@ extern "C" {
#define BT_AUDIO_UNICAST_ANNOUNCEMENT_GENERAL 0x00
#define BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED 0x01
#if defined(CONFIG_BT_AUDIO_BROADCAST_SINK)
#define BROADCAST_SNK_STREAM_CNT CONFIG_BT_AUDIO_BROADCAST_SNK_STREAM_COUNT
#define BROADCAST_SUBGROUP_CNT CONFIG_BT_AUDIO_BROADCAST_SUBGROUP_COUNT
#else /* !CONFIG_BT_AUDIO_BROADCAST_SINK */
#define BROADCAST_SNK_STREAM_CNT 0
#define BROADCAST_SUBGROUP_CNT 0
#endif /* CONFIG_BT_AUDIO_BROADCAST_SINK*/
/** @brief Abstract Audio Unicast Group structure. */
struct bt_audio_unicast_group;

View file

@ -49,3 +49,4 @@ zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_UNICAST_SERVER unicast_server.c)
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_CAPABILITIES capabilities.c)
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_UNICAST_CLIENT unicast_client.c)
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_BROADCAST_SOURCE broadcast_source.c)
zephyr_library_sources_ifdef(CONFIG_BT_AUDIO_BROADCAST_SINK broadcast_sink.c)

View file

@ -149,6 +149,40 @@ config BT_AUDIO_BROADCAST_SRC_STREAM_COUNT
endif # BT_AUDIO_BROADCAST_SOURCE
config BT_AUDIO_BROADCAST_SINK
bool "Bluetooth Broadcast Sink Audio Support [EXPERIMENTAL]"
select EXPERIMENTAL
select BT_ISO_SYNC_RECEIVER
help
This option enables support for Bluetooth Broadcast Sink Audio using
Isochronous channels.
if BT_AUDIO_BROADCAST_SINK
config BT_AUDIO_BROADCAST_SUBGROUP_COUNT
int # hidden: TODO: Update once the API supports it
default 1
config BT_AUDIO_BROADCAST_SNK_COUNT
int "Basic Audio Broadcaster Sink count"
default 1
range 0 BT_ISO_MAX_BIG
help
This option sets the number of broadcast sinks to support.
One broadcast sink can receive multiple streams
(up to BT_AUDIO_BROADCAST_SNK_STREAM_COUNT per broadcast sink).
config BT_AUDIO_BROADCAST_SNK_STREAM_COUNT
int "Basic Audio Broadcast Sink Stream count"
depends on BT_AUDIO_BROADCAST_SNK_COUNT > 0
default 1
range 1 BT_ISO_MAX_CHAN
help
This option sets the maximum number of streams per broadcast sink
to support.
endif # BT_AUDIO_BROADCAST_SINK
config BT_AUDIO_DEBUG
bool "Enable debug logs"
depends on BT_DEBUG
@ -207,17 +241,25 @@ config BT_AUDIO_DEBUG_BROADCAST_SOURCE
Use this option to enable Bluetooth Audio Broadcast Source debug logs
for the Bluetooth Audio functionality.
config BT_AUDIO_DEBUG_BROADCAST_SINK
bool "Bluetooth Audio Broadcast Sink debug"
depends on BT_AUDIO_BROADCAST_SINK
help
Use this option to enable Bluetooth Audio Broadcast Sink debug logs
for the Bluetooth Audio functionality.
endif # BT_AUDIO_DEBUG
config BT_AUDIO_STREAM
# Virtual/hidden option
bool
default y if BT_ASCS || BT_AUDIO_UNICAST_CLIENT || BT_AUDIO_BROADCAST_SOURCE
default y if BT_ASCS || BT_AUDIO_UNICAST_CLIENT || \
BT_AUDIO_BROADCAST_SOURCE || BT_AUDIO_BROADCAST_SINK
config BT_AUDIO_CAPABILITIES
# Virtual/hidden option
bool
default y if BT_ASCS
default y if BT_ASCS || BT_AUDIO_BROADCAST_SINK
rsource "Kconfig.pacs"
rsource "Kconfig.ascs"

File diff suppressed because it is too large Load diff

View file

@ -185,9 +185,10 @@ bool bt_audio_valid_qos(const struct bt_codec_qos *qos)
static bool bt_audio_stream_is_broadcast(const struct bt_audio_stream *stream)
{
/* TODO: Add broadcast sink */
return (IS_ENABLED(CONFIG_BT_AUDIO_BROADCAST_SOURCE) &&
bt_audio_ep_is_broadcast_src(stream->ep));
bt_audio_ep_is_broadcast_src(stream->ep)) ||
(IS_ENABLED(CONFIG_BT_AUDIO_BROADCAST_SINK) &&
bt_audio_ep_is_broadcast_snk(stream->ep));
}
bool bt_audio_valid_stream_qos(const struct bt_audio_stream *stream,

View file

@ -39,6 +39,7 @@ CONFIG_BT_AUDIO=y
CONFIG_BT_AUDIO_UNICAST_SERVER=y
CONFIG_BT_AUDIO_UNICAST_CLIENT=y
CONFIG_BT_AUDIO_BROADCAST_SOURCE=y
CONFIG_BT_AUDIO_BROADCAST_SINK=y
CONFIG_BT_ISO_TX_BUF_COUNT=5
CONFIG_BT_VOCS_MAX_INSTANCE_COUNT=1
CONFIG_BT_VOCS_CLIENT_MAX_INSTANCE_COUNT=1