From 672223d05524fc743cc843d5ac47a635bf89f07b Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Fri, 13 Aug 2021 23:20:47 +0300 Subject: [PATCH] bluez5: avoid poll busy loop in a2dp-sink Disable flush polling when we don't have data ready to write to the socket (or socket send failed). This avoids entering into a poll busy loop, which may result to rtkit killing the process. --- spa/plugins/bluez5/a2dp-sink.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index 10adb8212..248f02672 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -647,6 +647,7 @@ again: spa_log_trace(this->log, NAME" %p: error flushing %s", this, spa_strerror(written)); reset_buffer(this); + enable_flush(this, false); return written; } else if (written > 0) { @@ -660,6 +661,11 @@ again: enable_flush(this, false); } + else { + /* Don't want to flush yet, or failed to write anything */ + spa_log_trace(this->log, NAME" %p: skip flush", this); + enable_flush(this, false); + } return 0; }