Bug 103426

Summary: stuttering audio when paired to phone with bluetooth
Product: PulseAudio Reporter: Brian J. Murrell <brian>
Component: coreAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: major    
Priority: medium CC: lennart
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: pactl list output

Description Brian J. Murrell 2017-10-23 18:14:15 UTC
Created attachment 135016 [details]
pactl list output

I have my Android phone paired to my Fedora 26 machine via Bluetooth.

I am trying to play from a music app on the phone to PA on the Fedora machine.

While it basically works, I am getting a lot of stuttering.  When this stuttering happens the following can be found in a "-vvvv" log output:

D: [alsa-sink-HDMI 0] sink.c: alsa_output.pci-0000_00_03.0.hdmi-stereo: Found underrun 864 bytes ago (10776 bytes ahead in playback buffer)
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
D: [alsa-sink-HDMI 0] sink.c: alsa_output.pci-0000_00_03.0.hdmi-stereo: Found underrun 3808 bytes ago (7768 bytes ahead in playback buffer)
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
D: [alsa-sink-HDMI 0] sink.c: alsa_output.pci-0000_00_03.0.hdmi-stereo: Found underrun 7328 bytes ago (4312 bytes ahead in playback buffer)
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
D: [alsa-sink-HDMI 0] sink.c: alsa_output.pci-0000_00_03.0.hdmi-stereo: Found underrun 10912 bytes ago (728 bytes ahead in playback buffer)
D: [alsa-sink-HDMI 0] sink.c: alsa_output.pci-0000_00_03.0.hdmi-stereo: Found underrun 10912 bytes ago (88 bytes ahead in playback buffer)
D: [alsa-sink-HDMI 0] sink.c: alsa_output.pci-0000_00_03.0.hdmi-stereo: Found underrun 10912 bytes ago (88 bytes ahead in playback buffer)
D: [alsa-sink-HDMI 0] sink.c: alsa_output.pci-0000_00_03.0.hdmi-stereo: Found underrun 10912 bytes ago (24 bytes ahead in playback buffer)
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue
I: [alsa-sink-HDMI 0] module-loopback.c: Could not peek into queue

As you can see, I am using the audio in the HDMI adapter in this machine which is a:

00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)

I've attached a "pactl list" output.

Any ideas would be much appreciated.
Comment 1 Tanu Kaskinen 2017-10-24 13:44:08 UTC
It looks like the problem might be that we're not receiving audio fast enough from the phone. The "Could not peek into queue" messages are printed when the HDMI sink wants more data, but there's nothing in the loopback buffer.

It would be nice to see this reproduced on PulseAudio 11.0 (or later). That version has significant improvements in module-loopback's buffer management.

One thing to try would be to unload the wifi kernel module. Wifi often interferes with the bluetooth radio.
Comment 2 Brian J. Murrell 2017-10-24 14:06:05 UTC
(In reply to Tanu Kaskinen from comment #1)
> It looks like the problem might be that we're not receiving audio fast
> enough from the phone. The "Could not peek into queue" messages are printed
> when the HDMI sink wants more data, but there's nothing in the loopback
> buffer.

Interesting.
 
> It would be nice to see this reproduced on PulseAudio 11.0 (or later). That
> version has significant improvements in module-loopback's buffer management.

I will see if I can get to there from here.
 
> One thing to try would be to unload the wifi kernel module. Wifi often
> interferes with the bluetooth radio.

I did see several references to wifi interference while researching this issue but the machine this is running on doesn't have any wifi.
Comment 3 Brian J. Murrell 2017-10-25 12:38:37 UTC
pulseaudio 11[.1] is much(!) better.

There are still random little blips every now and then.  Kind of like the artefact of a scratch on a CD.  Not sure if that is PA/bluetooth buffering or what.  Maybe there is not enough of a buffer to accommodate momentary radio interference on the BT signal or something.

But overall, much much better.  It's actually listenable now.
Comment 4 GitLab Migration User 2018-07-30 10:28:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/450.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.