2023-02-19 18:02:13

by Pauli Virtanen

[permalink] [raw]
Subject: [PATCH BlueZ] audio/transport: update BAP transport QOS values when changed

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



2023-02-19 19:09:49

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ] audio/transport: update BAP transport QOS values when changed

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

2023-02-21 22:30:27

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ] audio/transport: update BAP transport QOS values when changed

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:

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