From b8d65895c262eac4e6a35d6adfd5873aa26673f2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 2 Sep 2020 17:51:33 +0200 Subject: [PATCH] a2dp: try to completely process the queue Continue processing the input data until we can't send anymore. When we are following another driver, we need to process each buffer in the cycle completely or we will start lagging behind. --- spa/plugins/bluez5/a2dp-sink.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index 60d7b42bf..ff6f523c4 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -560,6 +560,7 @@ static int flush_data(struct impl *this, uint64_t now_time) struct port *port = &this->port; total_frames = 0; +again: while (!spa_list_is_empty(&port->ready)) { uint8_t *src; uint32_t n_bytes, n_frames; @@ -642,6 +643,8 @@ static int flush_data(struct impl *this, uint64_t now_time) increase_bitpool(this); this->last_error = now_time; } + if (!spa_list_is_empty(&port->ready)) + goto again; } this->flush_source.mask = 0;