* [PATCH BlueZ v1] shared/bap: Fix not using metadata set on stream->meta
@ 2025-06-16 13:52 Luiz Augusto von Dentz
2025-06-16 15:20 ` [BlueZ,v1] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2025-06-16 13:52 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
bt_bap_stream_metadata maybe used before enabling state in which case it
will be store in the stream->meta so when processing
bt_bap_stream_enable if there is no metadata set use the existing one
set in stream->meta.
---
src/shared/bap.c | 47 +++++++++++++++++++++++++++++++++++++----------
1 file changed, 37 insertions(+), 10 deletions(-)
diff --git a/src/shared/bap.c b/src/shared/bap.c
index 3fae72d9d8a2..2cc970c0ef91 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -2276,6 +2276,17 @@ static unsigned int bap_ucast_qos(struct bt_bap_stream *stream,
return req->id;
}
+static void bap_stream_get_context(size_t i, uint8_t l, uint8_t t, uint8_t *v,
+ void *user_data)
+{
+ bool *found = user_data;
+
+ if (!v)
+ return;
+
+ *found = true;
+}
+
static unsigned int bap_stream_metadata(struct bt_bap_stream *stream,
uint8_t op, struct iovec *data,
bt_bap_stream_func_t func,
@@ -2284,11 +2295,7 @@ static unsigned int bap_stream_metadata(struct bt_bap_stream *stream,
struct iovec iov[2];
struct bt_ascs_metadata meta;
struct bt_bap_req *req;
- struct metadata {
- uint8_t len;
- uint8_t type;
- uint8_t data[2];
- } ctx = LTV(0x02, 0x01, 0x00); /* Context = Unspecified */
+ uint16_t value = cpu_to_le16(0x0001); /* Context = Unspecified */
memset(&meta, 0, sizeof(meta));
@@ -2297,13 +2304,33 @@ static unsigned int bap_stream_metadata(struct bt_bap_stream *stream,
iov[0].iov_base = &meta;
iov[0].iov_len = sizeof(meta);
- if (data)
- iov[1] = *data;
- else {
- iov[1].iov_base = &ctx;
- iov[1].iov_len = sizeof(ctx);
+ if (data) {
+ util_iov_free(stream->meta, 1);
+ stream->meta = util_iov_dup(data, 1);
}
+ /* Check if metadata contains an Audio Context */
+ if (stream->meta) {
+ uint8_t type = 0x02;
+ bool found = false;
+
+ util_ltv_foreach(stream->meta->iov_base,
+ stream->meta->iov_len, &type,
+ bap_stream_get_context, &found);
+ if (!found)
+ util_ltv_push(stream->meta, sizeof(value), type,
+ &value);
+ }
+
+ /* If metadata doesn't contain an Audio Context, add one */
+ if (!stream->meta) {
+ stream->meta = new0(struct iovec, 1);
+ util_ltv_push(stream->meta, sizeof(value), 0x02, &value);
+ }
+
+ iov[1].iov_base = stream->meta->iov_base;
+ iov[1].iov_len = stream->meta->iov_len;
+
meta.len = iov[1].iov_len;
req = bap_req_new(stream, op, iov, 2, func, user_data);
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [BlueZ,v1] shared/bap: Fix not using metadata set on stream->meta
2025-06-16 13:52 [PATCH BlueZ v1] shared/bap: Fix not using metadata set on stream->meta Luiz Augusto von Dentz
@ 2025-06-16 15:20 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2025-06-16 15:20 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 3487 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=972538
---Test result---
Test Summary:
CheckPatch PENDING 0.30 seconds
GitLint PENDING 0.30 seconds
BuildEll PASS 20.47 seconds
BluezMake PASS 3066.47 seconds
MakeCheck FAIL 14.23 seconds
MakeDistcheck FAIL 179.04 seconds
CheckValgrind FAIL 249.58 seconds
CheckSmatch WARNING 306.33 seconds
bluezmakeextell PASS 132.68 seconds
IncrementalBuild PENDING 0.36 seconds
ScanBuild PASS 928.09 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:
./test-driver: line 107: 32335 Aborted (core dumped) "$@" > $log_file 2>&1
make[3]: *** [Makefile:11806: test-suite.log] Error 1
make[2]: *** [Makefile:11914: check-TESTS] Error 2
make[1]: *** [Makefile:12343: check-am] Error 2
make: *** [Makefile:12345: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:
Package cups was not found in the pkg-config search path.
Perhaps you should add the directory containing `cups.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cups' found
../../test-driver: line 107: 55272 Aborted (core dumped) "$@" > $log_file 2>&1
make[4]: *** [Makefile:11806: test-suite.log] Error 1
make[3]: *** [Makefile:11914: check-TESTS] Error 2
make[2]: *** [Makefile:12343: check-am] Error 2
make[1]: *** [Makefile:12345: check] Error 2
make: *** [Makefile:12266: distcheck] Error 1
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12907:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12907 | int main(int argc, char *argv[])
| ^~~~
./test-driver: line 107: 75220 Aborted (core dumped) "$@" > $log_file 2>&1
make[3]: *** [Makefile:11806: test-suite.log] Error 1
make[2]: *** [Makefile:11914: check-TESTS] Error 2
make[1]: *** [Makefile:12343: check-am] Error 2
make: *** [Makefile:12345: check] Error 2
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:317:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-16 15:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 13:52 [PATCH BlueZ v1] shared/bap: Fix not using metadata set on stream->meta Luiz Augusto von Dentz
2025-06-16 15:20 ` [BlueZ,v1] " bluez.test.bot
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.