linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] audio/transport: update BAP transport QOS values when changed
@ 2023-02-19 18:02 Pauli Virtanen
  2023-02-19 19:09 ` [BlueZ] " bluez.test.bot
  2023-02-21 22:30 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Pauli Virtanen @ 2023-02-19 18:02 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Currently, BAP transport publishes on DBus QOS values obtained at
transport creation time. For BAP server the transport creation usually
occurs before stream QOS is configured, and these values are then all
zero. bap->sdu is also never set.

Update transport QOS values in DBus when stream state changes.  Since
nearly all QOS values are exposed in the transport, use bt_bap_qos to
store them there for simplicity.
---
 profiles/audio/transport.c | 62 ++++++++++++++++++++++++++------------
 1 file changed, 43 insertions(+), 19 deletions(-)

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index 912f404e8..457590746 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -84,13 +84,7 @@ struct bap_transport {
 	struct bt_bap_stream	*stream;
 	unsigned int		state_id;
 	bool			linked;
-	uint32_t		interval;
-	uint8_t			framing;
-	uint8_t			phy;
-	uint16_t		sdu;
-	uint8_t			rtn;
-	uint16_t		latency;
-	uint32_t		delay;
+	struct bt_bap_qos	qos;
 };
 
 struct media_transport {
@@ -823,7 +817,8 @@ static gboolean get_interval(const GDBusPropertyTable *property,
 	struct media_transport *transport = data;
 	struct bap_transport *bap = transport->data;
 
-	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &bap->interval);
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32,
+							&bap->qos.interval);
 
 	return TRUE;
 }
@@ -833,7 +828,7 @@ static gboolean get_framing(const GDBusPropertyTable *property,
 {
 	struct media_transport *transport = data;
 	struct bap_transport *bap = transport->data;
-	dbus_bool_t val = bap->framing;
+	dbus_bool_t val = bap->qos.framing;
 
 	dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &val);
 
@@ -846,7 +841,7 @@ static gboolean get_sdu(const GDBusPropertyTable *property,
 	struct media_transport *transport = data;
 	struct bap_transport *bap = transport->data;
 
-	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &bap->sdu);
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &bap->qos.sdu);
 
 	return TRUE;
 }
@@ -857,7 +852,7 @@ static gboolean get_retransmissions(const GDBusPropertyTable *property,
 	struct media_transport *transport = data;
 	struct bap_transport *bap = transport->data;
 
-	dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, &bap->rtn);
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_BYTE, &bap->qos.rtn);
 
 	return TRUE;
 }
@@ -868,7 +863,8 @@ static gboolean get_latency(const GDBusPropertyTable *property,
 	struct media_transport *transport = data;
 	struct bap_transport *bap = transport->data;
 
-	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &bap->latency);
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16,
+							&bap->qos.latency);
 
 	return TRUE;
 }
@@ -879,7 +875,7 @@ static gboolean get_delay(const GDBusPropertyTable *property,
 	struct media_transport *transport = data;
 	struct bap_transport *bap = transport->data;
 
-	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &bap->delay);
+	dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &bap->qos.delay);
 
 	return TRUE;
 }
@@ -1183,6 +1179,38 @@ static void bap_update_links(const struct media_transport *transport)
 	DBG("stream %p linked %s", bap->stream, bap->linked ? "true" : "false");
 }
 
+static void bap_update_qos(const struct media_transport *transport)
+{
+	struct bap_transport *bap = transport->data;
+	struct bt_bap_qos *qos;
+
+	qos = bt_bap_stream_get_qos(bap->stream);
+
+	if (!memcmp(qos, &bap->qos, sizeof(struct bt_bap_qos)))
+		return;
+
+	bap->qos = *qos;
+
+	g_dbus_emit_property_changed(btd_get_dbus_connection(),
+			transport->path, MEDIA_TRANSPORT_INTERFACE,
+			"Interval");
+	g_dbus_emit_property_changed(btd_get_dbus_connection(),
+			transport->path, MEDIA_TRANSPORT_INTERFACE,
+			"Framing");
+	g_dbus_emit_property_changed(btd_get_dbus_connection(),
+			transport->path, MEDIA_TRANSPORT_INTERFACE,
+			"SDU");
+	g_dbus_emit_property_changed(btd_get_dbus_connection(),
+			transport->path, MEDIA_TRANSPORT_INTERFACE,
+			"Retransmissions");
+	g_dbus_emit_property_changed(btd_get_dbus_connection(),
+			transport->path, MEDIA_TRANSPORT_INTERFACE,
+			"Latency");
+	g_dbus_emit_property_changed(btd_get_dbus_connection(),
+			transport->path, MEDIA_TRANSPORT_INTERFACE,
+			"Delay");
+}
+
 static guint resume_bap(struct media_transport *transport,
 				struct media_owner *owner)
 {
@@ -1327,6 +1355,7 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state,
 		if (owner && owner->pending)
 			return;
 		bap_update_links(transport);
+		bap_update_qos(transport);
 		transport_update_playing(transport, FALSE);
 		return;
 	case BT_BAP_STREAM_STATE_DISABLING:
@@ -1408,12 +1437,7 @@ static int media_transport_init_bap(struct media_transport *transport,
 
 	bap = new0(struct bap_transport, 1);
 	bap->stream = stream;
-	bap->interval = qos->interval;
-	bap->framing = qos->framing;
-	bap->phy = qos->phy;
-	bap->rtn = qos->rtn;
-	bap->latency = qos->latency;
-	bap->delay = qos->delay;
+	bap->qos = *qos;
 	bap->state_id = bt_bap_state_register(bt_bap_stream_get_session(stream),
 						bap_state_changed,
 						bap_connecting,
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ] audio/transport: update BAP transport QOS values when changed
  2023-02-19 18:02 [PATCH BlueZ] audio/transport: update BAP transport QOS values when changed Pauli Virtanen
@ 2023-02-19 19:09 ` bluez.test.bot
  2023-02-21 22:30 ` [PATCH BlueZ] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2023-02-19 19:09 UTC (permalink / raw)
  To: linux-bluetooth, pav

[-- Attachment #1: Type: text/plain, Size: 945 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=723301

---Test result---

Test Summary:
CheckPatch                    PASS      0.54 seconds
GitLint                       PASS      0.34 seconds
BuildEll                      PASS      26.22 seconds
BluezMake                     PASS      741.85 seconds
MakeCheck                     PASS      11.06 seconds
MakeDistcheck                 PASS      147.97 seconds
CheckValgrind                 PASS      239.27 seconds
CheckSmatch                   PASS      317.40 seconds
bluezmakeextell               PASS      95.57 seconds
IncrementalBuild              PASS      602.44 seconds
ScanBuild                     PASS      944.47 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] audio/transport: update BAP transport QOS values when changed
  2023-02-19 18:02 [PATCH BlueZ] audio/transport: update BAP transport QOS values when changed Pauli Virtanen
  2023-02-19 19:09 ` [BlueZ] " bluez.test.bot
@ 2023-02-21 22:30 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2023-02-21 22:30 UTC (permalink / raw)
  To: Pauli Virtanen; +Cc: linux-bluetooth

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Sun, 19 Feb 2023 18:02:03 +0000 you wrote:
> Currently, BAP transport publishes on DBus QOS values obtained at
> transport creation time. For BAP server the transport creation usually
> occurs before stream QOS is configured, and these values are then all
> zero. bap->sdu is also never set.
> 
> Update transport QOS values in DBus when stream state changes.  Since
> nearly all QOS values are exposed in the transport, use bt_bap_qos to
> store them there for simplicity.
> 
> [...]

Here is the summary with links:
  - [BlueZ] audio/transport: update BAP transport QOS values when changed
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=1bfd597fe881

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-21 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-19 18:02 [PATCH BlueZ] audio/transport: update BAP transport QOS values when changed Pauli Virtanen
2023-02-19 19:09 ` [BlueZ] " bluez.test.bot
2023-02-21 22:30 ` [PATCH BlueZ] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).