summaryrefslogtreecommitdiff
path: root/profiles
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2023-02-11 19:55:53 +0000
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2023-02-13 12:17:26 -0800
commit7b1b1a499cf334efa6b190ccaa8fb9ef223f66b4 (patch)
treeb6ddc5dc39ecbdcb0e3aa8809eee388570429be2 /profiles
parentf56205e3056428e2f9d49c8805d52240214c4915 (diff)
downloadbluez-7b1b1a499cf334efa6b190ccaa8fb9ef223f66b4.tar.gz
media: clear the right transport when clearing BAP endpoint
Each configured BAP stream is associated with a transport, and only that transport should be cleared when the stream's configuration is cleared. This is required for multiple BAP clients to use the same Media1 endpoint, which is what we should aim for to follow the spirit in which the endpoints work in ASCS. Sound servers generally can handle this, since the *Configuration calls provide the transport paths, and for different clients they are associated with different devices.
Diffstat (limited to 'profiles')
-rw-r--r--profiles/audio/media.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 505c4b3a6..3eb038cb7 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -86,7 +86,6 @@ struct endpoint_request {
struct media_endpoint {
struct a2dp_sep *sep;
struct bt_bap_pac *pac;
- void *stream;
char *sender; /* Endpoint DBus bus id */
char *path; /* Endpoint object path */
char *uuid; /* Endpoint property UUID */
@@ -1007,9 +1006,6 @@ static void pac_config_cb(struct media_endpoint *endpoint, void *ret, int size,
struct pac_config_data *data = user_data;
gboolean *ret_value = ret;
- if (ret_value)
- endpoint->stream = data->stream;
-
data->cb(data->stream, ret_value ? 0 : -EINVAL);
}
@@ -1089,11 +1085,20 @@ static int pac_config(struct bt_bap_stream *stream, struct iovec *cfg,
static void pac_clear(struct bt_bap_stream *stream, void *user_data)
{
struct media_endpoint *endpoint = user_data;
+ struct media_transport *transport;
+ const char *path;
+
+ path = bt_bap_stream_get_user_data(stream);
+ if (!path)
+ return;
- endpoint->stream = NULL;
+ DBG("endpoint %p path %s", endpoint, path);
- while (endpoint->transports != NULL)
- clear_configuration(endpoint, endpoint->transports->data);
+ transport = find_transport(endpoint, path);
+ if (transport) {
+ clear_configuration(endpoint, transport);
+ bt_bap_stream_set_user_data(stream, NULL);
+ }
}
static struct bt_bap_pac_ops pac_ops = {