diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index d3e834d..fa5cf1f 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
return NULL;
}
+static void iso_connect_bcast_cb(GIOChannel *chan, GError *err,
+ gpointer user_data)
+{
+ struct bt_bap_stream *stream = user_data;
+ int fd;
+
+ if (err) {
+ error("%s", err->message);
+ bt_bap_stream_set_io(stream, -1);
+ return;
+ }
+
+ DBG("ISO connected");
+
+ fd = g_io_channel_unix_get_fd(chan);
+
+ if (bt_bap_stream_set_io(stream, fd)) {
+ bt_bap_stream_start(stream, NULL, NULL);
+ g_io_channel_set_close_on_unref(chan, FALSE);
+ return;
+ }
+
+ error("Unable to set IO");
+ bt_bap_stream_set_io(stream, -1);
+}
+
static void iso_connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
{
struct bt_bap_stream *stream = user_data;
return FALSE;
}
+static void bap_connect_bcast_io_cb(GIOChannel *chan, GError *err,
+ gpointer user_data)
+{
+ struct bap_ep *ep = user_data;
+
+ if (!ep->stream)
+ return;
+
+ iso_connect_bcast_cb(chan, err, ep->stream);
+}
+
static void bap_connect_io_cb(GIOChannel *chan, GError *err, gpointer user_data)
{
struct bap_ep *ep = user_data;
DBG("ep %p stream %p ", ep, stream);
ba2str(btd_adapter_get_address(adapter), addr);
- io = bt_io_connect(bap_connect_io_cb, ep, NULL, &err,
+ io = bt_io_connect(bap_connect_bcast_io_cb, ep, NULL, &err,
BT_IO_OPT_SOURCE_BDADDR,
btd_adapter_get_address(adapter),
BT_IO_OPT_DEST_BDADDR,
}
break;
case BT_BAP_STREAM_STATE_QOS:
- bap_create_io(data, ep, stream, true);
+ if (bt_bap_stream_get_type(stream) ==
+ BT_BAP_STREAM_TYPE_UCAST) {
+ bap_create_io(data, ep, stream, true);
+ }
break;
case BT_BAP_STREAM_STATE_ENABLING:
if (ep)
bap_create_io(data, ep, stream, false);
break;
case BT_BAP_STREAM_STATE_STREAMING:
- if (bt_bap_stream_get_type(stream) ==
- BT_BAP_STREAM_TYPE_BCAST) {
- if (ep)
- bap_create_io(data, ep, stream, false);
- }
break;
}
}
ep->qos.bcast.big = qos.bcast.big;
ep->qos.bcast.bis = qos.bcast.bis;
+ bt_bap_stream_config(ep->stream, &ep->qos,
+ ep->caps, NULL, NULL);
}
DBG("stream %p fd %d: BIG 0x%02x BIS 0x%02x", stream, fd,