Message ID | 20231102155827.4219-3-silviu.barbulescu@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Add support for bcast multiple BISes | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | success | CheckPatch PASS |
tedd_an/GitLint | success | Gitlint PASS |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
Hi Silviu, On Thu, Nov 2, 2023 at 11:58 AM Silviu Florian Barbulescu <silviu.barbulescu@nxp.com> wrote: > > From: Claudia Draghicescu <claudia.rosu@nxp.com> > > When registering both sink and source endpoints, > the register endpoint method call results in 2 remote endpoints for each > scanned broadcast source There seems to be 2 patches with the same subject? > --- > profiles/audio/bap.c | 27 +++++++++++++++------------ > 1 file changed, 15 insertions(+), 12 deletions(-) > > diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c > index b74498c4c..a84181e1a 100644 > --- a/profiles/audio/bap.c > +++ b/profiles/audio/bap.c > @@ -1050,7 +1050,7 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data, > const char *suffix; > struct match_ep match = { lpac, rpac }; > > - switch (bt_bap_pac_get_type(rpac)) { > + switch (bt_bap_pac_get_type(lpac)) { > case BT_BAP_BCAST_SOURCE: > case BT_BAP_BCAST_SINK: > queue = data->bcast; > @@ -1073,13 +1073,13 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data, > if (device) > ep->data->device = device; > > - switch (bt_bap_pac_get_type(rpac)) { > - case BT_BAP_BCAST_SINK: > + switch (bt_bap_pac_get_type(lpac)) { > + case BT_BAP_BCAST_SOURCE: > err = asprintf(&ep->path, "%s/pac_%s%d", > adapter_get_path(adapter), suffix, i); > ep->base = new0(struct iovec, 1); > break; > - case BT_BAP_BCAST_SOURCE: > + case BT_BAP_BCAST_SINK: > err = asprintf(&ep->path, "%s/pac_%s%d", > device_get_path(device), suffix, i); > ep->base = new0(struct iovec, 1); > @@ -1101,7 +1101,10 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data, > ep_free(ep); > return NULL; > } > - bt_bap_pac_set_user_data(rpac, ep->path); > + if (rpac) > + bt_bap_pac_set_user_data(rpac, ep->path); > + else > + bt_bap_pac_set_user_data(lpac, ep->path); It is probably a good idea to add comment here why it is necessary to check if rpac is set. > DBG("ep %p lpac %p rpac %p path %s", ep, ep->lpac, ep->rpac, ep->path); > > @@ -1792,7 +1795,7 @@ static void bap_listen_io_broadcast(struct bap_data *data, struct bap_ep *ep, > error("%s", err->message); > g_error_free(err); > } > - > + ep->io = io; > ep->data->listen_io = io; > > } > @@ -1958,12 +1961,12 @@ static void pac_added_broadcast(struct bt_bap_pac *pac, void *user_data) > { > struct bap_data *data = user_data; > > - if (bt_bap_pac_get_type(pac) == BT_BAP_BCAST_SOURCE) > - bt_bap_foreach_pac(data->bap, BT_BAP_BCAST_SOURCE, > - pac_found_bcast, data); > - else if (bt_bap_pac_get_type(pac) == BT_BAP_BCAST_SINK) > - bt_bap_foreach_pac(data->bap, BT_BAP_BCAST_SINK, > - pac_found_bcast, data); > + if (bt_bap_pac_bcast_is_local(data->bap, pac) && > + (bt_bap_pac_get_type(pac) == BT_BAP_BCAST_SOURCE)) > + pac_found_bcast(pac, NULL, user_data); Im not really sure we need bt_bap_pac_bcast_is_local, can't we just assume it based on BT_BAP_BCAST_SOURCE? > + else > + bt_bap_foreach_pac(data->bap, bt_bap_pac_get_type(pac), > + pac_found_bcast, data); > } > > static bool ep_match_pac(const void *data, const void *match_data) > -- > 2.39.2 >
diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index b74498c4c..a84181e1a 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1050,7 +1050,7 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data, const char *suffix; struct match_ep match = { lpac, rpac }; - switch (bt_bap_pac_get_type(rpac)) { + switch (bt_bap_pac_get_type(lpac)) { case BT_BAP_BCAST_SOURCE: case BT_BAP_BCAST_SINK: queue = data->bcast; @@ -1073,13 +1073,13 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data, if (device) ep->data->device = device; - switch (bt_bap_pac_get_type(rpac)) { - case BT_BAP_BCAST_SINK: + switch (bt_bap_pac_get_type(lpac)) { + case BT_BAP_BCAST_SOURCE: err = asprintf(&ep->path, "%s/pac_%s%d", adapter_get_path(adapter), suffix, i); ep->base = new0(struct iovec, 1); break; - case BT_BAP_BCAST_SOURCE: + case BT_BAP_BCAST_SINK: err = asprintf(&ep->path, "%s/pac_%s%d", device_get_path(device), suffix, i); ep->base = new0(struct iovec, 1); @@ -1101,7 +1101,10 @@ static struct bap_ep *ep_register_bcast(struct bap_data *data, ep_free(ep); return NULL; } - bt_bap_pac_set_user_data(rpac, ep->path); + if (rpac) + bt_bap_pac_set_user_data(rpac, ep->path); + else + bt_bap_pac_set_user_data(lpac, ep->path); DBG("ep %p lpac %p rpac %p path %s", ep, ep->lpac, ep->rpac, ep->path); @@ -1792,7 +1795,7 @@ static void bap_listen_io_broadcast(struct bap_data *data, struct bap_ep *ep, error("%s", err->message); g_error_free(err); } - + ep->io = io; ep->data->listen_io = io; } @@ -1958,12 +1961,12 @@ static void pac_added_broadcast(struct bt_bap_pac *pac, void *user_data) { struct bap_data *data = user_data; - if (bt_bap_pac_get_type(pac) == BT_BAP_BCAST_SOURCE) - bt_bap_foreach_pac(data->bap, BT_BAP_BCAST_SOURCE, - pac_found_bcast, data); - else if (bt_bap_pac_get_type(pac) == BT_BAP_BCAST_SINK) - bt_bap_foreach_pac(data->bap, BT_BAP_BCAST_SINK, - pac_found_bcast, data); + if (bt_bap_pac_bcast_is_local(data->bap, pac) && + (bt_bap_pac_get_type(pac) == BT_BAP_BCAST_SOURCE)) + pac_found_bcast(pac, NULL, user_data); + else + bt_bap_foreach_pac(data->bap, bt_bap_pac_get_type(pac), + pac_found_bcast, data); } static bool ep_match_pac(const void *data, const void *match_data)
From: Claudia Draghicescu <claudia.rosu@nxp.com> When registering both sink and source endpoints, the register endpoint method call results in 2 remote endpoints for each scanned broadcast source --- profiles/audio/bap.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)