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.
This commit is contained in:
Pauli Virtanen 2021-08-13 23:20:47 +03:00
parent 5071589aea
commit 672223d055

View file

@ -647,6 +647,7 @@ again:
spa_log_trace(this->log, NAME" %p: error flushing %s", this, spa_log_trace(this->log, NAME" %p: error flushing %s", this,
spa_strerror(written)); spa_strerror(written));
reset_buffer(this); reset_buffer(this);
enable_flush(this, false);
return written; return written;
} }
else if (written > 0) { else if (written > 0) {
@ -660,6 +661,11 @@ again:
enable_flush(this, false); 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; return 0;
} }