From: Andrei Istodorescu <andrei.istodorescu@nxp.com>
To: linux-bluetooth@vger.kernel.org
Cc: luiz.dentz@gmail.com, mihai-octavian.urzica@nxp.com,
silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com,
iulia.tanasescu@nxp.com,
Andrei Istodorescu <andrei.istodorescu@nxp.com>
Subject: [PATCH BlueZ v3 1/2] shared/bap: Update stream management to avoid PACs
Date: Mon, 13 May 2024 14:50:13 +0300 [thread overview]
Message-ID: <20240513115014.36484-2-andrei.istodorescu@nxp.com> (raw)
In-Reply-To: <20240513115014.36484-1-andrei.istodorescu@nxp.com>
Remove PAC logic for BAP Broadcast Sink stream creation.
---
src/shared/bap.c | 63 +++++-------------------------------------------
1 file changed, 6 insertions(+), 57 deletions(-)
diff --git a/src/shared/bap.c b/src/shared/bap.c
index 818326f45dd2..ff3e36a6fbc2 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2005,10 +2005,7 @@ static unsigned int bap_bcast_enable(struct bt_bap_stream *stream,
bt_bap_stream_func_t func,
void *user_data)
{
- if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE)
- stream_set_state(stream, BT_BAP_STREAM_STATE_STREAMING);
- else
- stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG);
+ stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG);
return 1;
}
@@ -5287,7 +5284,6 @@ void bt_bap_cancel_select(struct bt_bap_pac *lpac, bt_bap_pac_select_t func,
static struct bt_bap_stream *bap_bcast_stream_new(struct bt_bap *bap,
struct bt_bap_pac *lpac,
- struct bt_bap_pac *rpac,
struct bt_bap_qos *pqos,
struct iovec *data)
{
@@ -5298,71 +5294,24 @@ static struct bt_bap_stream *bap_bcast_stream_new(struct bt_bap *bap,
if (!bap)
return NULL;
- if (!rpac && (lpac->type != BT_BAP_BCAST_SOURCE)
- && queue_isempty(bap->remote_eps))
- return NULL;
-
- if (lpac && rpac) {
- if ((rpac->type != BT_BAP_BCAST_SOURCE)
- && (!bap_codec_equal(&lpac->codec, &rpac->codec)))
- return NULL;
- } else {
- uint8_t type;
-
+ if (lpac->type == BT_BAP_BCAST_SOURCE) {
match.lpac = lpac;
- match.rpac = rpac;
+ match.rpac = NULL;
memset(&match.codec, 0, sizeof(match.codec));
- if (rpac)
- type = rpac->type;
- else if (lpac) {
- switch (lpac->type) {
- case BT_BAP_BCAST_SOURCE:
- type = BT_BAP_BCAST_SINK;
- break;
- case BT_BAP_BCAST_SINK:
- type = BT_BAP_BCAST_SOURCE;
- break;
- default:
- return NULL;
- }
- } else
- return NULL;
-
- bt_bap_foreach_pac(bap, type, match_pac, &match);
+ bt_bap_foreach_pac(bap, BT_BAP_BCAST_SINK, match_pac, &match);
if ((!match.lpac) || (!lpac))
return NULL;
- if (!match.rpac && (lpac->type != BT_BAP_BCAST_SOURCE))
- return NULL;
lpac = match.lpac;
- rpac = match.rpac;
- }
- match.lpac = lpac;
- match.rpac = rpac;
-
- if (lpac->type != BT_BAP_BCAST_SOURCE) {
- /* Check for existing stream */
- ep = queue_find(bap->remote_eps, find_ep_pacs, &match);
- if (!ep) {
- /* Check for unused ASE */
- ep = queue_find(bap->remote_eps, find_ep_unused,
- &match);
- if (!ep) {
- DBG(bap, "Unable to find unused ASE");
- return NULL;
- }
- }
- stream = ep->stream;
- } else {
ep = queue_find(bap->remote_eps, find_ep_source, NULL);
if (!ep)
return NULL;
}
if (!stream)
- stream = bap_stream_new(bap, ep, lpac, rpac, data, true);
+ stream = bap_stream_new(bap, ep, lpac, NULL, data, true);
return stream;
}
@@ -5415,7 +5364,7 @@ struct bt_bap_stream *bt_bap_stream_new(struct bt_bap *bap,
if (bt_bap_get_att(bap))
return bap_ucast_stream_new(bap, lpac, rpac, pqos, data);
- return bap_bcast_stream_new(bap, lpac, rpac, pqos, data);
+ return bap_bcast_stream_new(bap, lpac, pqos, data);
}
struct bt_bap *bt_bap_stream_get_session(struct bt_bap_stream *stream)
--
2.40.1
next prev parent reply other threads:[~2024-05-13 11:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 11:50 [PATCH BlueZ v3 0/2] Create transports for matching BISes Andrei Istodorescu
2024-05-13 11:50 ` Andrei Istodorescu [this message]
2024-05-13 12:25 ` bluez.test.bot
2024-05-13 11:50 ` [PATCH BlueZ v3 2/2] bap: " Andrei Istodorescu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240513115014.36484-2-andrei.istodorescu@nxp.com \
--to=andrei.istodorescu@nxp.com \
--cc=iulia.tanasescu@nxp.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=mihai-octavian.urzica@nxp.com \
--cc=silviu.barbulescu@nxp.com \
--cc=vlad.pruteanu@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.