From cb10d87bb8b471a68766cb6305df462d2d45891a Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Thu, 22 Jul 2021 22:22:40 +0300 Subject: [PATCH] bluez5: handle no data written to sco socket If socket write results to EAGAIN/EWOULDBLOCK or rx data starts late, spa_bt_sco_io_write may return 0, and we should give up and skip ahead (and not loop in RT thread with very small timeout). --- spa/plugins/bluez5/sco-sink.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spa/plugins/bluez5/sco-sink.c b/spa/plugins/bluez5/sco-sink.c index 5443b5a86..cba5d4418 100644 --- a/spa/plugins/bluez5/sco-sink.c +++ b/spa/plugins/bluez5/sco-sink.c @@ -458,6 +458,9 @@ static void flush_data(struct impl *this) if (written < 0) { spa_log_warn(this->log, "sco-sink: write failure: %d", written); goto stop; + } else if (written == 0) { + /* EAGAIN or similar, just skip ahead */ + written = SPA_MIN(port->write_buffer_size, (uint32_t)48); } processed = written;