diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index 208e739..4630e52 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
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");