@@ -606,11 +606,38 @@ static DBusMessage *try_acquire(DBusConnection *conn, DBusMessage *msg,
return NULL;
}
+static void bap_stop_complete(struct bt_bap_stream *stream,
+ uint8_t code, uint8_t reason,
+ void *user_data)
+{
+ struct media_owner *owner = user_data;
+ struct media_request *req = owner->pending;
+ struct media_transport *transport = owner->transport;
+
+ /* Release always succeeds */
+ if (req) {
+ req->id = 0;
+ media_request_reply(req, 0);
+ media_owner_remove(owner);
+ }
+
+ transport_set_state(transport, TRANSPORT_STATE_IDLE);
+ media_transport_remove_owner(transport);
+}
+
+static void bap_disable_complete(struct bt_bap_stream *stream,
+ uint8_t code, uint8_t reason,
+ void *user_data)
+{
+ bap_stop_complete(stream, code, reason, user_data);
+}
+
static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
void *data)
{
struct media_transport *transport = data;
struct media_owner *owner = transport->owner;
+ struct bap_transport *bap = transport->data;
const char *sender;
struct media_request *req;
guint id;
@@ -642,6 +669,11 @@ static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
req = media_request_create(msg, id);
media_owner_add(owner, req);
+ if (bt_bap_stream_get_type(bap->stream) ==
+ BT_BAP_STREAM_TYPE_BCAST) {
+ bap_disable_complete(bap->stream, 0x00, 0x00, owner);
+ }
+
return NULL;
}
@@ -1370,32 +1402,6 @@ static guint resume_bap(struct media_transport *transport,
return id;
}
-static void bap_stop_complete(struct bt_bap_stream *stream,
- uint8_t code, uint8_t reason,
- void *user_data)
-{
- struct media_owner *owner = user_data;
- struct media_request *req = owner->pending;
- struct media_transport *transport = owner->transport;
-
- /* Release always succeeds */
- if (req) {
- req->id = 0;
- media_request_reply(req, 0);
- media_owner_remove(owner);
- }
-
- transport_set_state(transport, TRANSPORT_STATE_IDLE);
- media_transport_remove_owner(transport);
-}
-
-static void bap_disable_complete(struct bt_bap_stream *stream,
- uint8_t code, uint8_t reason,
- void *user_data)
-{
- bap_stop_complete(stream, code, reason, user_data);
-}
-
static guint suspend_bap(struct media_transport *transport,
struct media_owner *owner)
{
@@ -1499,9 +1505,14 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state,
return;
break;
case BT_BAP_STREAM_STATE_STREAMING:
- if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE)
+ if ((bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE) ||
+ (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK))
bap_update_bcast_qos(transport);
break;
+ case BT_BAP_STREAM_STATE_RELEASING:
+ if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK)
+ return;
+ break;
}
io = bt_bap_stream_get_io(stream);