From c560149e1afb362c32dbaa709662e9e6ddabfbaf Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Thu, 16 Oct 2025 15:40:06 -0400 Subject: [PATCH] shared/bap: Fix bt_bap_stream_io_get_qos for broadcast streams This makes bt_bap_stream_io_get_qos work with broadcast streams. --- src/shared/bap.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 6573ea39c..427d18627 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -6800,6 +6800,36 @@ static void bap_stream_get_out_qos(void *data, void *user_data) *qos = &stream->qos; } +static void bap_stream_bcast_get_out_qos(void *data, void *user_data) +{ + struct bt_bap_stream *stream = data; + struct bt_bap_qos **qos = user_data; + + if (!stream) + return; + + if (!qos || *qos || stream->ep->dir != BT_BAP_BCAST_SINK || + !stream->qos.bcast.io_qos.sdu) + return; + + *qos = &stream->qos; +} + +static void bap_stream_bcast_get_in_qos(void *data, void *user_data) +{ + struct bt_bap_stream *stream = data; + struct bt_bap_qos **qos = user_data; + + if (!stream) + return; + + if (!qos || *qos || stream->ep->dir != BT_BAP_BCAST_SOURCE || + !stream->qos.bcast.io_qos.sdu) + return; + + *qos = &stream->qos; +} + bool bt_bap_stream_io_get_qos(struct bt_bap_stream *stream, struct bt_bap_qos **in, struct bt_bap_qos **out) @@ -6816,13 +6846,19 @@ bool bt_bap_stream_io_get_qos(struct bt_bap_stream *stream, bap_stream_get_out_qos(stream, out); queue_foreach(stream->links, bap_stream_get_in_qos, in); break; + case BT_BAP_BCAST_SOURCE: + bap_stream_bcast_get_in_qos(stream, in); + break; + case BT_BAP_BCAST_SINK: + bap_stream_bcast_get_out_qos(stream, out); + break; default: return false; } DBG(stream->bap, "in %p out %p", in ? *in : NULL, out ? *out : NULL); - return in && out; + return (in && *in) || (out && *out); } static void bap_stream_get_dir(void *data, void *user_data) -- 2.47.3