From 2760c151bd6d982fd49da4975a9aafa6b3103a44 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sat, 2 Jan 2021 22:10:13 +0200 Subject: [PATCH] sco-source: fix bugs in buffer handling Buffers sent to io should be marked outstanding, also in node_process. port->current_buffer has to be initialized together with buffer lists. --- spa/plugins/bluez5/sco-source.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spa/plugins/bluez5/sco-source.c b/spa/plugins/bluez5/sco-source.c index 932c205f8..ae4dcf9ad 100644 --- a/spa/plugins/bluez5/sco-source.c +++ b/spa/plugins/bluez5/sco-source.c @@ -274,6 +274,8 @@ static void reset_buffers(struct port *port) spa_list_init(&port->free); spa_list_init(&port->ready); + port->current_buffer = NULL; + for (i = 0; i < port->n_buffers; i++) { struct buffer *b = &port->buffers[i]; spa_list_append(&port->free, &b->link); @@ -841,6 +843,7 @@ static int clear_buffers(struct impl *this, struct port *port) spa_list_init(&port->ready); port->n_buffers = 0; } + port->current_buffer = NULL; return 0; } @@ -1037,7 +1040,7 @@ static int impl_node_process(void *object) /* Get the new buffer from the ready list */ buffer = spa_list_first(&port->ready, struct buffer, link); spa_list_remove(&buffer->link); - buffer->outstanding = false; + buffer->outstanding = true; /* Set the new buffer in IO */ io->buffer_id = buffer->id;