diff --git a/src/shared/bap.c b/src/shared/bap.c
index b452461..cc1fa1f 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
void *user_data)
{
const struct queue_entry *lchan, *rchan;
+ int selected = 0;
if (!lpac || !rpac || !func)
return -EINVAL;
rc->location, &rpac->qos,
func, user_data,
lpac->user_data);
- if (count)
- (*count)++;
+ selected++;
/* Check if there are any channels left to select */
map.count &= ~(map.count & rc->count);
}
}
+ /* Fallback to no channel allocation since none could be matched. */
+ if (!selected) {
+ lpac->ops->select(lpac, rpac, 0, &rpac->qos, func, user_data,
+ lpac->user_data);
+ selected++;
+ }
+
+ if (count)
+ *count += selected;
+
return 0;
}