Ubuntu Lucid / PulseAudio Alsa-Plugin : 2 sec delay

Bug #582600 reported by oliveiro on 2010-05-19

This bug report will be marked for expiration in 39 days if no further activity occurs. (find out why)

54
This bug affects 11 people
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: pulseaudio

I installed a fresh Ubuntu Lucid, and updated from Lucid-proposed.
Kernel is 2.6.32-22-generic. Did not installed anything particular.
Didn't add any fancy repo or ppa...
I'm using xdtv to watch tv, and a descrambler based on alsa.
Works nice in Karmic and Jaunty. No noticable latency...
But in Lucid I get a 2 sec delay between audio and video.
with pulseaudio in verbose mode, I notice very few differences
between Lucid and Karmic, when I launch the tv program:
The main difference is the order in which "source alsa_input"
and "Sink alsa_output" are processed. And there's a 2000 ms
latency request here that seems to be my problem.

I tried many things from related bugs-reports I found around here
starting with checking openal1 from proposed, re-compiling alsa from source,
using kernel2.34, audio-dev-team ppa or ricotz ppa for newer alsa and pulseaudio
None of which succeeded...

Anyone has a clue ?
This is my first bug report on launchpad, so I'm sorry if I mispost here or mis-whatever
And sorry also for my poor english !

PS : my soundboard is an AC'97, always worked perfectly 9.10, 9.04 8.10...etc

oliveiro (oli-lambert) wrote :

I don't know what kind of relevant log I could add to this report...
Here's attached, what happens in syslog when I launch xdtv and its alsa plug-in
with pulseaudio in debug mode.

lshw :
  *-multimedia:0
       description: Multimedia audio controller
       product: AC'97 Sound Controller
       vendor: Silicon Integrated Systems [SiS]
       physical id: 2.7
       bus info: pci@0000:00:02.7
       version: a0
       width: 32 bits
       clock: 33MHz
       capabilities: bus_master cap_list
       configuration: driver=Intel ICH latency=32 maxlatency=11 mingnt=52
       resources: irq:18 ioport:dc00(size=256) ioport:d800(size=128)

lsmod :
snd_usb_audio 75826 2
snd_intel8x0 25499 3
snd_hwdep 5604 1 snd_usb_audio
snd_usb_lib 16066 1 snd_usb_audio
snd_ac97_codec 100687 1 snd_intel8x0
ac97_bus 1002 1 snd_ac97_codec
snd_seq_dummy 1434 0
snd_seq_oss 27210 0
snd_seq_midi 4557 0
snd_rawmidi 19077 2 snd_usb_lib,snd_seq_midi
snd_bt87x 9602 2
snd_pcm_oss 34571 0
snd_seq_midi_event 6003 2 snd_seq_oss,snd_seq_midi
snd_mixer_oss 13865 1 snd_pcm_oss
snd_seq 47562 6 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_seq_midi_event
snd_pcm 70947 5 snd_usb_audio,snd_intel8x0,snd_ac97_codec,snd_bt87x,snd_pcm_oss
snd_seq_device 5988 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_seq
snd_timer 18656 2 snd_seq,snd_pcm
snd 55491 30 snd_usb_audio,snd_intel8x0,snd_hwdep,snd_usb_lib,snd_ac97_codec,snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_bt87x,snd_pcm_oss,snd_mixer_oss,snd_seq,snd_pcm,snd_seq_device,snd_timer
snd_page_alloc 7076 3 snd_intel8x0,snd_bt87x,snd_pcm
soundcore 6620 1 snd

oliveiro (oli-lambert) wrote :

And also, here's the same syslog but under Karmic:
(where the 2 sec delay does NOT happen)

I see a lot of differences now, but I don't know how to interprete them
For instance lot of:
 "alsa-sink.c: Requesting rewind due to latency change"
or
"memblockq.c: memblockq requested: "
and some
"alsa-util.c: Maximum hw buffer size is 341 ms"

that do not occur in lucid...

What's strange, it's that under Karmic there are many messages from " pulseaudio sink-input.c" creating, then freeing inputs "ALSA Playback" before succeeding. And also another difference I observe, is that in karmic
"source-output.c: Created output "ALSA Capture"" occurs before "sink-input.c: Created input "ALSA Playback""

In lucid the order is inverted : first sink-input, then source output.
And all "protocol-native.c: Final latency" are the same in Lucid and Karmic.

Finally, I also notice a message in Karmic, which is not in Lucid
"protocol-native.c: Early requests mode enabled, configuring sink latency to minreq."
But again, all final latencies are equal (?!?)

Voilà....

Sorry again if my report is a bit messy.

oliveiro (oli-lambert) wrote :

ok, so I kept on trying...

I tried to add tsched=0 in /etc/pulse/default.pa
I tried modifying rate or priorities in /etc/pulse/daemon.conf
I tried to add my user to pulse's groups
I tried to change /etc/security/limits.conf or rtkit
None of these was successfull

BTW, removing pulseaudio was a successfull attempt : no noticeable latency or delay,
but sound was a bit choppy, and mostly, I don't want to get rid of pulse.
That's a workaround anyway...

I'm now going to try real-time kernel...

Is anyone reading this ????

Please revert all your modifications, and install
linux-alsa-driver-modules-$(uname -r) from ppa:ubuntu-audio-dev.

oliveiro (oli-lambert) wrote :

Hello Daniel,
I read many of your posts around here ;-)
Well thank you for your answer, but as I wrote in my first post, I already tried ppa:ubuntu-audio-dev...
without success. To follow your advice, and to double-check, I did a fresh install again, updated with
lucid-proposed activated, added ppa:ubuntu-audio-dev and installed linux-alsa-driver-modules from there
(Kernel is 2.6.32-22-generic). Failed again...
I notice that logs change : "rewind" messages and also "memblockq.c" messages appear, they did not
before i used ppa:ubuntu-audio-dev.
But I still get an approx. 2 sec delay on the audio. And the message

source-output.c: Created output "ALSA Capture"

occurs last, after the message

"sink-input.c: Created input "ALSA Playback""

In Karmic, it was the contrary.
I still don't if it's related.
Thanks for your help !

Daniel T Chen (crimsun) wrote :

Can you also attach a verbose pulse daemon log and complete dmesg dump, please?

oliveiro (oli-lambert) wrote :

Here they are...
I

oliveiro (oli-lambert) wrote :
oliveiro (oli-lambert) wrote :
oliveiro (oli-lambert) wrote :
oliveiro (oli-lambert) wrote :

I also attached Karmic logs to compare...
I put pulse/daemon.conf to debug mode, so dmesg includes a lot of messages from pulse at boot.
Lucid is still running with audio-dev-team ppa module installed.
I also notice that since I upgraded this module from audio-dev-team ppa, system sounds (only them) stutter heavily.
The rest is working ok (playing music or video with various players)
And of course I still have the 2 sec delay in lucid, not in karmic, when watching tv with the alsa-plugin-descrambler.
Thank you.

oliveiro (oli-lambert) wrote :

Daniel, did you have time to think about this ?
A look on the logs ?
Or anyone else, a clue ?
Thanks
O.

Daniel T Chen (crimsun) wrote :

Not yet, I'm very busy ATM, will try to look this weekend.

Le 27/05/2010 15:19, Daniel T Chen a écrit :
> Not yet, I'm very busy ATM, will try to look this weekend.
>
>
ok. thank you !

oliveiro (oli-lambert) wrote :

I'm Still facing the same problem even after todays updates from audio-team-dev.
Anyone with the same bug ? Any advice ?
Thanks!

Andrew Tannenbaum (atannen) wrote :

I am having the same 2-second delay when I run sox (with pulseaudio) on a small file:

  /usr/bin/play /usr/lib/openoffice/basis3.2/share/gallery/sounds/ok.wav

I posted more info here:

  https://bugs.launchpad.net/ubuntu/+source/sox/+bug/591003

when I reported it as a sox bug, though it's pulseaudio.
(When I kill pulseaudio, the problem goes away).

Attached is a pulseadio log. The delay seems to start at the point in the log when the following is printed:

D: protocol-native.c: Underrun on 'ALSA Playback', 0 bytes in queue.
D: sink-input.c: Requesting rewind due to corking
D: module-suspend-on-idle.c: Sink alsa_output.pci-0000_00_1b.0.analog-stereo becomes idle, timeout in 5 seconds.

oliveiro (oli-lambert) wrote :

Hi Andrew,
I don't use Sox. It's a real time audio processor, isn't it ?
As far as this bug is concerned, I didn't check latest updates, cos I
went back to KKoala as my main system,
Since I use this computer as a media & web center... and I meet to many
problems in LLynx (wifi disconnecting, audio latency...)
even if it looks like a very stable and fast release. Since it's LTS, I
hope these bugs will be corrected.
I'll give another try this weekend, And maybe i'll check sox, and will
try to reproduce your bug.
Cheers
Oli

Hi Oli,

sox is a command-line audio tool.

http://en.wikipedia.org/wiki/SoX

I found the bug using sox, but it looks like other people are finding
the bug in other audio tools, and the bug is really in PulseAudio.

-Andy

On Fri, Jul 2, 2010 at 6:24 PM, oliveiro <email address hidden> wrote:
> Hi Andrew,
> I don't use Sox. It's a real time audio processor, isn't it ?
> As far as this bug is concerned, I didn't check latest updates, cos I
> went back to KKoala as my main system,
> Since I use this computer as a media & web center... and I meet to many
> problems in LLynx (wifi disconnecting, audio latency...)
> even if it looks like a very stable and fast release. Since it's LTS, I
> hope these bugs will be corrected.
> I'll give another try this weekend, And maybe i'll check sox, and will
> try to reproduce your bug.
> Cheers
> Oli
>
> --
> Ubuntu Lucid / PulseAudio Alsa-Plugin : 2 sec delay
> https://bugs.launchpad.net/bugs/582600
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in “pulseaudio” package in Ubuntu: New
>
> Bug description:
> Binary package hint: pulseaudio
>
> I installed a fresh Ubuntu Lucid, and updated from Lucid-proposed.
> Kernel is 2.6.32-22-generic. Did not installed anything particular.
> Didn't add any fancy repo or ppa...
> I'm using xdtv to watch tv, and a descrambler based on alsa.
> Works nice in Karmic and Jaunty. No noticable latency...
> But in Lucid I get a 2 sec delay between audio and video.
> with pulseaudio in verbose mode, I notice very few differences
> between Lucid and Karmic, when I launch the tv program:
> The main difference is the order in which "source alsa_input"
> and "Sink alsa_output" are processed. And there's a 2000 ms
> latency request here that seems to be my problem.
>
> I tried many things from related bugs-reports I found around here
> starting with checking openal1 from proposed, re-compiling alsa from source,
> using kernel2.34, audio-dev-team ppa or ricotz ppa for newer alsa and pulseaudio
> None of which succeeded...
>
> Anyone has a clue ?
> This is my first bug report on launchpad, so I'm sorry if I mispost here or mis-whatever
> And sorry also for my poor english !
>
> PS : my soundboard is an AC'97, always worked perfectly 9.10, 9.04 8.10...etc
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/582600/+subscribe
>

Thomas Hebb (tchebb) on 2010-07-15
Changed in pulseaudio (Ubuntu):
status: New → Confirmed
C R (weblionx) wrote :

I'm getting this problem, too. Pretty much anything that uses alsa (and therefore pulseaudio through the alsa-plugin) for me has a roughly 30 second delay. This happens with flash, as well as the native Enemy Territory: Quake Wars port, as it uses alsa and is unlikely to ever be updated for pulse-audio. This makes sound on 10.04 virtually useless most of the time for me, whereas sound worked reasonably well in 9.10.

oliveiro (oli-lambert) wrote :

Hi all, I'm back online and I can confirm the bug still exists.

Andrew, I installed Sox, but could you guide me to reproduce your bug ?

webster Leone, just a guess, but I think you're not meeting the exact same bug than us :
you might want to check http://ubuntuforums.org/showthread.php?t=1452902

Daniel, are you still around ?

Andrew Tannenbaum (atannen) wrote :

Hi Oliveiro,

Welcome back. I have details about the bug, including a guide to reproducing it with sox, in bug report 591003

from that report:

This command should run for .4 seconds, but it runs for 3.1 seconds.
It plays the sound correctly and then waits for a couple of seconds instead of exiting immediately.
The bug happens on any wav file.
It worked correctly before 10.04.

$ time play /usr/lib/openoffice/basis3.2/share/gallery/sounds/ok.wav

etc...

(play is part of sox)

-Andy

oliveiro (oli-lambert) wrote :

Hi Andy
I'm sorry, but I could not reproduce your bug ;
using the "time" function, nor with the "play" command, neither with mplayer
did I get a significant difference between Karmic and Lucid.
Both gave me a "real" play time of approximately 1.2 sec, to play the 0.4 sec file... (mplayer was faster)

But I still notice a 2 sec delay concerning the bug I reported.
BTW I also get the futex messages, both in karmic and Lucid

????

oliveiro (oli-lambert) wrote :

I've found an old post :

https://bugs.launchpad.net/ubuntu/+source/alsa-plugins/+bug/485488/comments/23

Definitely related to mine but in Karmic. Weird because I never encountered it in Karmic...
Could it be a lucid-regression in Pulseaudio/Alsa-plugins ?

Oli

Andrew Tannenbaum (atannen) wrote :

Oli,

Before I saw this bug, I did upgrade from Karmic to Lucid (rather than installing Lucid on an empty drive), and am still running Lucid, as noted in my original report in 591003 (but I am now running 2.6.32-24-generic):

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: sox 14.3.0-1.1build1
ProcVersionSignature: Ubuntu 2.6.32-22.33-generic 2.6.32.11+drm33.2
Uname: Linux 2.6.32-22-generic i686
Architecture: i386
Date: Mon Jun 7 17:38:46 2010
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: sox

Karmic ran ok, and Lucid (with pulseaudio) has the slow audio bug for me. It is possible that a fresh install, rather than an incremental install might fix my problem, but that means something is wrong with the incremental install. (Is it possible that I should try to reinstall some packages?)

I still have the bug as before, where playing a sound file results in an extra delay of about 2 seconds or more. This is a problem when I have code that uses /usr/bin/play on several sounds in a row, and I expect them to play in rapid sequence. If you play /usr/lib/openoffice/basis3.2/share/gallery/sounds/ok.wav and it is supposed to take .4 seconds, but instead it takes 3 seconds, if you play it 5 times, it takes 15 seconds instead of 2 seconds, which makes for a poor user experience.

codeslinger (codeslinger) wrote :

doing
time play /usr/lib/openoffice/basis3.2/share/gallery/sounds/ok.wav

I see the same similar result on 10.10 maverick meercat with different sound hardware from what you are using.

when I stopped pulseaudio from running, the delay went away!!!!

unlike you, I did not experience a sync problem when playing video files. However my sound input was unusable due to an approx 1 second delay and choppy/jerky sound on VoIP. killing pulseaudio also solved this problem.

codeslinger (codeslinger) wrote :

I belive that this bug has been fixed in the 13.04... at least for me, my audio finally works now, after being unusable for a long time and I was seeing same/similar behavior to what you saw. so give the newest version a try.

Daniel van Vugt (vanvugt) wrote :

Thank you for reporting this bug to Ubuntu.
Ubuntu 10.04 (lucid) reached end-of-life on May 9, 2013.

See this document for currently supported Ubuntu releases:
https://wiki.ubuntu.com/Releases

Please upgrade to the latest version and re-test.

Changed in pulseaudio (Ubuntu):
status: Confirmed → Incomplete
affects: pulseaudio (Debian) → mir
no longer affects: mir
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers