bluez5: iso-io: delay streaming start until all acquires are complete

For better start synchronization, we should wait until all ISO nodes
that are going to be started finish creating ISO io.

Add a separate ready flag for startup that is set when all Acquire
requests are complete.
This commit is contained in:
Pauli Virtanen 2025-12-21 15:07:16 +02:00 committed by Wim Taymans
parent 8b36e2d9b7
commit ac3ac3382b
3 changed files with 49 additions and 6 deletions

View file

@ -80,6 +80,7 @@ struct stream {
int fd;
bool sink;
bool idle;
bool ready;
spa_bt_iso_io_pull_t pull;
@ -268,6 +269,11 @@ static void group_on_timeout(struct spa_source *source)
if (!exp)
return;
spa_list_for_each(stream, &group->streams, link) {
if (!stream->ready)
goto done;
}
spa_list_for_each(stream, &group->streams, link) {
if (!stream->sink) {
if (!stream->pull) {
@ -343,7 +349,7 @@ done:
group->next += exp * group->duration_tx;
spa_list_for_each(stream, &group->streams, link) {
if (!stream->sink)
if (!stream->sink || !stream->ready)
continue;
if (resync)
@ -576,6 +582,24 @@ void spa_bt_iso_io_destroy(struct spa_bt_iso_io *this)
free(stream);
}
static int do_ready(struct spa_loop *loop, bool async, uint32_t seq, const void *data, size_t size, void *user_data)
{
struct stream *stream = user_data;
stream->ready = true;
return 0;
}
void spa_bt_iso_io_ready(struct spa_bt_iso_io *this)
{
struct stream *stream = SPA_CONTAINER_OF(this, struct stream, this);
struct group *group = stream->group;
int res;
res = spa_loop_locked(group->data_loop, do_ready, 0, NULL, 0, stream);
spa_assert_se(res == 0);
}
static bool group_is_enabled(struct group *group)
{
struct stream *stream;