Diff between f49953d96fab77fccf80ab5af56538ac749c3489 and d68dc1fd03bc86a5427ca8738c04fb692cc95263

Changed Files

File Additions Deletions Status
profiles/audio/bap.c +3 -3 modified
profiles/audio/bass.c +17 -5 modified
profiles/audio/bass.h +0 -5 modified

Full Patch

diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index b36e45e..37168e5 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1178,7 +1178,7 @@ static void bis_handler(uint8_t bis, uint8_t sgrp, struct iovec *caps,
 	struct bt_bap_pac *lpac;
 	char *path;
 
-	bass_add_stream(data->device, meta, caps, qos, sgrp, bis);
+	bt_bap_bis_probe(data->bap, bis, sgrp, caps, meta, qos);
 
 	/* Check if this BIS matches any local PAC */
 	bt_bap_verify_bis(data->bap, bis,
@@ -3128,9 +3128,9 @@ static void bap_bcast_remove(struct btd_service *service)
 		return;
 	}
 
-	bap_data_remove(data);
+	bt_bap_bis_remove(data->bap);
 
-	bass_remove_stream(device);
+	bap_data_remove(data);
 }
 
 static int bap_probe(struct btd_service *service)
diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c
index 96e7677..f5fe606 100644
--- a/profiles/audio/bass.c
+++ b/profiles/audio/bass.c
@@ -86,6 +86,7 @@ struct bass_data {
 	struct bt_bass *bass;
 	unsigned int src_id;
 	unsigned int cp_id;
+	unsigned int bis_id;
 };
 
 struct bass_assistant {
@@ -141,6 +142,11 @@ static struct bass_data *bass_data_new(struct btd_device *device);
 static void bass_data_add(struct bass_data *data);
 static void bass_data_remove(struct bass_data *data);
 
+static void bis_probe(uint8_t bis, uint8_t sgrp, struct iovec *caps,
+	struct iovec *meta, struct bt_bap_qos *qos, void *user_data);
+static void bis_remove(struct bt_bap *bap, void *user_data);
+
+
 static void bass_debug(const char *str, void *user_data)
 {
 	DBG_IDX(0xffff, "%s", str);
@@ -590,6 +596,8 @@ static void bap_attached(struct bt_bap *bap, void *user_data)
 
 	/* Create BASS session with the Broadcast Source */
 	data = bass_data_new(device);
+	data->bis_id = bt_bap_bis_cb_register(bap, bis_probe,
+					bis_remove, device, NULL);
 
 	bass_data_add(data);
 
@@ -678,8 +686,10 @@ static void bap_detached(struct bt_bap *bap, void *user_data)
 
 	/* Remove BASS session with the Broadcast Source device */
 	data = queue_find(sessions, match_device, device);
-	if (data)
+	if (data) {
+		bt_bap_bis_cb_unregister(bap, data->bis_id);
 		bass_data_remove(data);
+	}
 
 	dg = queue_remove_if(delegators, delegator_match_device, device);
 	if (!dg)
@@ -1077,10 +1087,10 @@ static struct bass_assistant *assistant_new(struct btd_adapter *adapter,
 	return assistant;
 }
 
-void bass_add_stream(struct btd_device *device, struct iovec *meta,
-			struct iovec *caps, struct bt_bap_qos *qos,
-			uint8_t sgrp, uint8_t bis)
+static void bis_probe(uint8_t bis, uint8_t sgrp, struct iovec *caps,
+	struct iovec *meta, struct bt_bap_qos *qos, void *user_data)
 {
+	struct btd_device *device = user_data;
 	const struct queue_entry *entry;
 	struct bt_bap *bap;
 	struct bt_bap_pac *pac;
@@ -1142,8 +1152,10 @@ static void unregister_assistant(void *data)
 				assistant->path, MEDIA_ASSISTANT_INTERFACE);
 }
 
-void bass_remove_stream(struct btd_device *device)
+static void bis_remove(struct bt_bap *bap, void *user_data)
 {
+	struct btd_device *device = user_data;
+
 	queue_remove_all(assistants, assistant_match_device,
 		device, unregister_assistant);
 }
diff --git a/profiles/audio/bass.h b/profiles/audio/bass.h
index 99b7552..42a2c04 100644
--- a/profiles/audio/bass.h
+++ b/profiles/audio/bass.h
@@ -7,11 +7,6 @@
  *
  */
 
-void bass_add_stream(struct btd_device *device, struct iovec *meta,
-			struct iovec *caps, struct bt_bap_qos *qos,
-			uint8_t sgrp, uint8_t bis);
-void bass_remove_stream(struct btd_device *device);
-
 typedef void (*bt_bass_bcode_func_t)(void *user_data, int err);
 
 void bass_req_bcode(struct bt_bap_stream *stream,