Bluetooth: BAP: Fix missing remove of streams from slist
In the broadcast sink when the streams disconnected (without the PA disconnecting), the streams were not properly removed from the sink's list of streams. This allowed the same stream to be added to the list twice, which would cause a infinite loop as the stream would point to itself as the next. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
6cefad338b
commit
5076476cf5
1 changed files with 3 additions and 9 deletions
|
|
@ -347,7 +347,6 @@ static void broadcast_sink_iso_disconnected(struct bt_iso_chan *chan,
|
|||
struct bt_bap_stream *stream;
|
||||
struct bt_bap_ep *ep = iso->rx.ep;
|
||||
struct bt_bap_broadcast_sink *sink;
|
||||
bool all_disconnected;
|
||||
|
||||
if (ep == NULL) {
|
||||
LOG_ERR("iso %p not bound with ep", chan);
|
||||
|
|
@ -378,17 +377,12 @@ static void broadcast_sink_iso_disconnected(struct bt_iso_chan *chan,
|
|||
return;
|
||||
}
|
||||
|
||||
all_disconnected = true;
|
||||
SYS_SLIST_FOR_EACH_CONTAINER(&sink->streams, stream, _node) {
|
||||
/* stream->ep is cleared when the steam disconnects */
|
||||
if (stream->ep != NULL) {
|
||||
all_disconnected = false;
|
||||
break;
|
||||
}
|
||||
if (!sys_slist_find_and_remove(&sink->streams, &stream->_node)) {
|
||||
LOG_DBG("Could not find and remove stream %p from sink %p", stream, sink);
|
||||
}
|
||||
|
||||
/* Clear sink->big if not already cleared */
|
||||
if (all_disconnected && sink->big) {
|
||||
if (sys_slist_is_empty(&sink->streams) && sink->big) {
|
||||
broadcast_sink_clear_big(sink, reason);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue