[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] bluetooth: Amend writeout to send more initial frames

PulseAudio Marge Bot (@pulseaudio-merge-bot) gitlab at gitlab.freedesktop.org
Mon Feb 6 18:58:31 UTC 2023



PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio


Commits:
3e5db72a by Igor V. Kovalenko at 2023-02-06T18:55:47+00:00
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>

- - - - -


1 changed file:

- src/modules/bluetooth/module-bluez5-device.c


Changes:

=====================================
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;
                         }



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/3e5db72ab759a33063e5af26f4b48ec3be1baed5

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/3e5db72ab759a33063e5af26f4b48ec3be1baed5
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20230206/193bd8cc/attachment-0001.htm>


More information about the pulseaudio-commits mailing list