From 84c336f2bd7aec174b516615c1bb521c57b1c5e0 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Fri, 8 Aug 2025 21:50:37 +0300 Subject: [PATCH] media: clear transport if reconfiguring in pac_config() We are not updating transport->configuration if transport already exists in pac_config(), so reconfiguration of a stream leaves sound server with old configuration. Do this in the same way we do for A2DP: first ClearConfiguration() to remove old transport, then SetConfiguration() to make new one with the new settings. --- profiles/audio/media.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 208e73959..4630e52db 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -1208,23 +1208,26 @@ static int pac_config(struct bt_bap_stream *stream, struct iovec *cfg, DBG("endpoint %p stream %p", endpoint, stream); transport = find_transport(endpoint, stream); - if (!transport) { - switch (bt_bap_stream_get_type(stream)) { - case BT_BAP_STREAM_TYPE_UCAST: - transport = pac_ucast_config(stream, cfg, endpoint); - break; - case BT_BAP_STREAM_TYPE_BCAST: - transport = pac_bcast_config(stream, cfg, endpoint); - break; - } - - if (!transport) - return -EINVAL; + if (transport) + clear_configuration(endpoint, transport); - endpoint->transports = g_slist_append(endpoint->transports, - transport); + switch (bt_bap_stream_get_type(stream)) { + case BT_BAP_STREAM_TYPE_UCAST: + transport = pac_ucast_config(stream, cfg, endpoint); + break; + case BT_BAP_STREAM_TYPE_BCAST: + transport = pac_bcast_config(stream, cfg, endpoint); + break; + default: + transport = NULL; + break; } + if (!transport) + return -EINVAL; + + endpoint->transports = g_slist_append(endpoint->transports, transport); + msg = dbus_message_new_method_call(endpoint->sender, endpoint->path, MEDIA_ENDPOINT_INTERFACE, "SetConfiguration"); -- 2.47.3