summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor V. Kovalenko <igor.v.kovalenko@gmail.com>2023-02-06 09:38:45 +0300
committerPulseAudio Marge Bot <pulseaudio-maintainers@lists.freedesktop.org>2023-02-06 18:55:47 +0000
commit3e5db72ab759a33063e5af26f4b48ec3be1baed5 (patch)
treee14763e48425f42da06be1de8921d28a7e01d6d4
parent86c5fbab5778685e19b5a4a9b8eb04ca90dff780 (diff)
downloadpulseaudio-3e5db72ab759a33063e5af26f4b48ec3be1baed5.tar.gz
bluetooth: Amend writeout to send more initial frames
When bluetooth transport has both both sink and source, pulseaudio would synchronize writing out frames with reading frames from peer to make fair schedule of reads and writes. Pulseaudio allows two blocks of data to be sent to peer before synchronizing writes with reads just in case that peer implements similar write schedule. It could happen that first blocks are still missed by peer, which would cause pulseaudio writes to stall waiting for first frames from peer. Fix this by allowing more data frames out until data from peer is actually received. Closes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1424 Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/777>
-rw-r--r--src/modules/bluetooth/module-bluez5-device.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c
index ab1bc098e..dc6809ce5 100644
--- a/src/modules/bluetooth/module-bluez5-device.c
+++ b/src/modules/bluetooth/module-bluez5-device.c
@@ -1549,8 +1549,8 @@ static void thread_func(void *userdata) {
writable = true;
/* If we have a source, we let the source determine the timing
- * for the sink */
- if (have_source) {
+ * for the sink unless peer has not sent any data yet */
+ if (have_source && u->read_index > 0) {
/* If the stream is writable, send some data if necessary */
if (writable) {
@@ -1663,6 +1663,12 @@ static void thread_func(void *userdata) {
goto fail;
if (result) {
+ if (have_source && u->read_index <= 0) {
+ /* We have a source but peer has not sent any data yet, log this */
+ if (pa_log_ratelimit(PA_LOG_DEBUG))
+ pa_log_debug("Still no data received from source, sent one more block to sink");
+ }
+
writable = false;
have_written = true;
}