https://bugs.kde.org/show_bug.cgi?id=415976

            Bug ID: 415976
           Summary: KDEConnect increases bluetooth buffer size, leading to
                    laggy sound in bluetooth headset via pulseaudio
           Product: kdeconnect
           Version: 1.3.5
          Platform: Gentoo Packages
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: common
          Assignee: albertv...@gmail.com
          Reporter: kde-b...@pyoworks.com
  Target Milestone: ---

It took me many sleepless nights to figure this out - I hope it will help
someone and/or result in a fix.

SUMMARY

I am using a bluetooth headset and an USB bluetooth dongle in a Pulseaudio KDE
setup for audio. After recently doing a fresh Gentoo installation, I noticed
audio lagging when playing gzdoom.

Starting pulseaudio in verbose mode (pulseaudio -v), I noticed that the
following messages appear shortly after starting any audio stream (mpg123,
gzdoom, youtube..) while having the bluetooth headset connected:

I: [bluetooth] module-bluez5-device.c: Changing bluetooth buffer size: Changed
from 5120 to 6144
I: [bluetooth] module-bluez5-device.c: Changing bluetooth buffer size: Changed
from 6144 to 7168
I: [bluetooth] module-bluez5-device.c: Changing bluetooth buffer size: Changed
from 7168 to 8192

Trying out endless Pulseaudio options, I realized that this buffer increase
only happens when the KDE desktop is running. Uninstalling and re-installing
step-by-step all KDE software related bluetooth, I finally was able to identify
KDEConnect as cause for these buffer changes. The buffer changes only happen
when KDEConnect (compiled with bluetooth support) is running and connected to
my phone.

Before discoverig this, I did not even know that KDEConnect has any bluetooth
functions at all. My phone is connected to KDEConnect via a Wifi network. 

Compiling KDEConnect without bluetooth support solved my problem: Bluetooth
buffer will not be increased anymore, and audio is not laggy anymore.




STEPS TO REPRODUCE
1. Install kdeconnect with bluetooth support (on gentoo:"USE=bluetooth emerge
kdeconnect"), connect to a phone (LAN)
2. Connect Bluetooth headset to USB dongle (Pulseaudio KDE setup)
3. Play any audio stream on computer with output to bluetooth headset (e.g.
mpg123, youtube, gzdoom)

OBSERVED RESULT

In the first ~15 seconds, audio will be in sync, not laggy.

Then, shortly after audio stream started, Pulseaudio will report that the
buffer size was increased ("I: [bluetooth] module-bluez5-device.c: Changing
bluetooth buffer size: Changed from ... to ...")

Audio will be out of sync with application and "laggy".


EXPECTED RESULT

The bluetooth buffer should not be increased. Especially if as in my I case,
when not (knowingly/proactively) using any bluetooth functionality of
KDEConnect.

As seen in PulseAudio bug report
(https://bugs.freedesktop.org/show_bug.cgi?id=58746) and comments in the
related source code of Pulseaudio, it is important to keep the buffer as small
as possible in order to prevent audio lag.



SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Linux sapphire 5.4.8-gentoo-x86_64 #1 SMP Sun Jan 5 16:18:12
CET 2020 x86_64 AMD Ryzen 7 3700X 8-Core Processor AuthenticAMD GNU/Linux

KDEConnect Vesion: kde-misc/kdeconnect-1.3.5:5::gentoo  USE="app bluetooth*
handbook -debug -mousepad (-selinux) -test -wayland"
KDE Plasma Version: 5.17.4
KDE Frameworks Version: 5.64.0
Qt Version: 5.13.2

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to