@@ -1085,19 +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;
+ GSList *item;
- path = bt_bap_stream_get_user_data(stream);
- if (!path)
- return;
+ DBG("endpoint %p stream %p", endpoint, stream);
- DBG("endpoint %p path %s", endpoint, path);
+ item = endpoint->transports;
+ while (item) {
+ struct media_transport *transport = item->data;
- transport = find_transport(endpoint, path);
- if (transport) {
- clear_configuration(endpoint, transport);
- bt_bap_stream_set_user_data(stream, NULL);
+ if (media_transport_get_stream(transport) == stream) {
+ clear_configuration(endpoint, transport);
+ item = endpoint->transports;
+ } else {
+ item = item->next;
+ }
}
}
@@ -1483,6 +1483,20 @@ const char *media_transport_get_path(struct media_transport *transport)
return transport->path;
}
+void *media_transport_get_stream(struct media_transport *transport)
+{
+ struct bap_transport *bap;
+ const char *uuid;
+
+ uuid = media_endpoint_get_uuid(transport->endpoint);
+ if (strcasecmp(uuid, PAC_SINK_UUID) &&
+ strcasecmp(uuid, PAC_SOURCE_UUID))
+ return NULL;
+
+ bap = transport->data;
+ return bap->stream;
+}
+
void media_transport_update_delay(struct media_transport *transport,
uint16_t delay)
{
@@ -19,6 +19,7 @@ struct media_transport *media_transport_create(struct btd_device *device,
void media_transport_destroy(struct media_transport *transport);
const char *media_transport_get_path(struct media_transport *transport);
+void *media_transport_get_stream(struct media_transport *transport);
struct btd_device *media_transport_get_dev(struct media_transport *transport);
int8_t media_transport_get_volume(struct media_transport *transport);
void media_transport_update_delay(struct media_transport *transport,