From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> bt_bap_stream_metatada shall not send Update Metadata if the states don't allow it, instead it shall store it so it can be send later when enabling the stream. --- src/shared/bap.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/shared/bap.c b/src/shared/bap.c index 499e740c9..a7217b417 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -1971,8 +1971,17 @@ static unsigned int bap_ucast_metadata(struct bt_bap_stream *stream, return 0; } - return bap_stream_metadata(stream, BT_ASCS_METADATA, data, func, - user_data); + switch (bt_bap_stream_get_state(stream)) { + /* Valid only if ASE_State field = 0x03 (Enabling) */ + case BT_BAP_STREAM_STATE_ENABLING: + /* or 0x04 (Streaming) */ + case BT_BAP_STREAM_STATE_STREAMING: + return bap_stream_metadata(stream, BT_ASCS_METADATA, data, func, + user_data); + } + + stream_metadata(stream, data, NULL); + return 0; } static uint8_t stream_release(struct bt_bap_stream *stream, struct iovec *rsp) -- 2.45.0