shared/bap: Fix not using metadata set on stream->meta
Luiz Augusto von Dentz
maintainerPATCH 1/1 shared/bap: Fix not using metadata set on stream->meta
From: Luiz Augusto von Dentz <[email protected]>
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(-)
src/shared/bap.c +37 -10
@@ -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);
Signature · 1 line
2.49.0
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