public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v1 3/4] shared/bap: Fix not setting metadata
Date: Wed, 31 Jul 2024 14:57:17 +0100	[thread overview]
Message-ID: <20240731135718.429604-3-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20240731135718.429604-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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


  parent reply	other threads:[~2024-07-31 13:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-31 13:57 [PATCH BlueZ v1 1/4] client/player: Fix not setting config target_latency with edpoint.config Luiz Augusto von Dentz
2024-07-31 13:57 ` [PATCH BlueZ v1 2/4] monitor: Fix crash parsing notification Luiz Augusto von Dentz
2024-07-31 13:57 ` Luiz Augusto von Dentz [this message]
2024-07-31 13:57 ` [PATCH BlueZ v1 4/4] bap: Fix not setting metatada Luiz Augusto von Dentz
2024-07-31 16:58 ` [BlueZ,v1,1/4] client/player: Fix not setting config target_latency with edpoint.config bluez.test.bot
2024-07-31 17:10 ` [PATCH BlueZ v1 1/4] " patchwork-bot+bluetooth
2024-08-01  9:30 ` patchwork-bot+bluetooth

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=20240731135718.429604-3-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox