You are not logged in.

#1 2012-03-15 14:37:21

Cagnulein
Member
From: Modena, Italy
Registered: 2006-04-03
Posts: 260
Website

[SOLVED] Pulseaudio + Bluetooth = LAG

Hi,
i'm trying to setup a system composed by:
- 2 users on my pc (2 Xorg sessions always active)
- a TV connected via HDMI
- headphone wired
- bluetooth stereo headphone

Everything works fine with pulseaudio (system mode) except bluetooth: i can connect and transmit audio to headphone using this howto (http://en.gentoo-wiki.com/wiki/PulseAud … et_support) , but, after 2 or 3 minutes of streaming, audio lags.

If i restart pulseaudio, everything works fine but after 2 or 3 minutes lags again.

I've tried playing with "module-suspend-on-idle" without success.

This is my current configuration:

/etc/pulse/system.pa

.ifexists module-udev-detect.so
load-module module-udev-detect tsched=0
.else
### Use the static hardware detection module (for systems that lack udev/hal support)
load-module module-detect
.endif

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix

### Automatically restore the volume of streams and devices
#load-module module-stream-restore
#load-module module-device-restore

### Automatically restore the default sink/source when changed by the user
### during runtime
### NOTE: This should be loaded as early as possible so that subsequent modules
### that look up the default sink/source get the right value
load-module module-default-device-restore

.ifexists module-dbus-protocol.so
### If you want to allow TCP connections, set access to "remote" or "local,remote".
load-module module-dbus-protocol access=local
.endif

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### Enable positioned event sounds
load-module module-position-event-sounds

/etc/asound.conf

pcm.!default {
  type pulse
  fallback "sysdefault"
  hint {
    show on
    description "Default ALSA Output (currently PulseAudio Sound Server)"
  }
}

ctl.!default {
  type pulse
  fallback "sysdefault"
}

pcm.bluetooth {
type bluetooth
device 20:11:08:18:FB:F1
profile "auto"
}

Thanks in advance

Last edited by Cagnulein (2012-03-16 10:06:38)

Offline

#2 2012-03-16 01:32:32

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: [SOLVED] Pulseaudio + Bluetooth = LAG

Why does your asound.conf have a bluetooth device (pulseaudio shouldn't need one, I don't and I use bt audio frequently here). Also, this may have nothing to do with your problem but system-mode for PA invalidates some zero-copy features in pulse that can help with CPU usage etc.

Lagging after a while seems like buffering has run out, so you may want to try not using system-mode.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2012-03-16 08:05:17

Cagnulein
Member
From: Modena, Italy
Registered: 2006-04-03
Posts: 260
Website

Re: [SOLVED] Pulseaudio + Bluetooth = LAG

ngoonee wrote:

Why does your asound.conf have a bluetooth device (pulseaudio shouldn't need one, I don't and I use bt audio frequently here).

Because before touching asound.conf i can't see any bluetooth device on "Pulseaudio Volume Control". I guess it could be a system-mode issue, don't you think?

ngoonee wrote:

Also, this may have nothing to do with your problem but system-mode for PA invalidates some zero-copy features in pulse that can help with CPU usage etc.

Lagging after a while seems like buffering has run out, so you may want to try not using system-mode.

I'm using the system-mode because i have 2 users on the same machine working together (on 2 different Xorg sessions). I didn't find any other way to achieve it.
If i use 2 pulseaudio sessions (no-system-mode), i always hear sound from only a user (who starts first) with the wired headphone ( i didn't try bluetooth ).

Offline

#4 2012-03-16 09:13:43

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: [SOLVED] Pulseaudio + Bluetooth = LAG

If I'm not mistaken, bluez is supposed to take care of handing the BT device to PA (but I don't think that works on system mode, having never tried it out myself). Why not just give it a test, IF it works you could share devices using TCP tunnelling (much more involved than system mode though).


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#5 2012-03-16 10:06:22

Cagnulein
Member
From: Modena, Italy
Registered: 2006-04-03
Posts: 260
Website

Re: [SOLVED] Pulseaudio + Bluetooth = LAG

I've got it!
I follow this and everything works great.
Thanks

Offline

#6 2012-03-18 09:55:25

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: [SOLVED] Pulseaudio + Bluetooth = LAG

You should make sure you test it out with different order of logging in, as I think this won't work if user 2 logs in before user 1. But yes, this does indicate that your problem was most likely due to using system mode smile


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#7 2012-03-18 10:21:25

Cagnulein
Member
From: Modena, Italy
Registered: 2006-04-03
Posts: 260
Website

Re: [SOLVED] Pulseaudio + Bluetooth = LAG

Yeah, thanks for the tip wink

Offline

Board footer

Powered by FluxBB