Public bug reported:

Binary package hint: pulseaudio

The libpulse-simple API has a function, pa_simple_drain() which is
supposed to "[w]ait until all data already written is played by the
daemon".

However in Ubuntu 10.10, it waits a *fair* bit more than that, namely
several seconds(!)

This means, that when I want to synchronize audio in my program ie.
ensure that previously streamed audio has finished playing, e.g. before
I start playing a new sound or just prior to exiting the program, there
is a typically 2.2 second extra delay!

Without this call, at the end of playback before exiting, the final
sound will be clipped off at the end, since there is still unbuffered
audio waiting to be sent, so it is needed to call this at the end of the
program, but now in 10.10, it causes an extra delay of several seconds
before the program exits.

I have attached a program that demonstrates this behaviour. Compile
with:

$ gcc `pkg-config --cflags --libs libpulse-simple` -o beep beep.c

Here is the output from the program:

$ ./beep
[0.039147] playing 440 hz tone volume 50 for 500 ms
[0.291107] play done
[0.291116] not calling pa_simple_drain()
[0.293467] playing 680 hz tone volume 50 for 500 ms
[0.855440] play done
[0.855459] not calling pa_simple_drain()
[0.857808] playing 440 hz tone volume 50 for 500 ms
[1.312107] play done
[3.544309] pa_simple_drain() done
[3.546687] playing 680 hz tone volume 50 for 500 ms
[3.798973] play done
[6.132183] pa_simple_drain() done
[6.134535] playing 440 hz tone volume 50 for 500 ms
[6.386808] play done
[6.386824] not calling pa_simple_drain()
[6.386851] playing 440 hz tone volume 0 for 500 ms
[6.951772] play done
[6.951789] not calling pa_simple_drain()
[6.956659] playing 880 hz tone volume 50 for 1000 ms
[7.912965] play done
[10.144917] pa_simple_drain() done

I am reporting this here rather than upstream, since I have observed it
in latest Ubuntu, and I don't think it was in 10.04, but if it is
determined to be a PulseAudio bug I will report it upstream as well...

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: pulseaudio 1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu21
ProcVersionSignature: Ubuntu 2.6.35-22.33-generic 2.6.35.4
Uname: Linux 2.6.35-22-generic x86_64
NonfreeKernelModules: nvidia
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.23.
AplayDevices:
 **** List of PLAYBACK Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
Architecture: amd64
ArecordDevices:
 **** List of CAPTURE Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: AD198x Analog [AD198x Analog]
   Subdevices: 2/2
   Subdevice #0: subdevice #0
   Subdevice #1: subdevice #1
AudioDevicesInUse:
 USER        PID ACCESS COMMAND
 /dev/snd/controlC0:  th        10977 F.... pulseaudio
Card0.Amixer.info:
 Card hw:0 'Intel'/'HDA Intel at 0xfdffc000 irq 45'
   Mixer name   : 'Analog Devices AD1984'
   Components   : 'HDA:11d41984,10280214,00100400'
   Controls      : 21
   Simple ctrls  : 14
Date: Thu Oct 14 15:21:42 2010
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Release Candidate amd64 
(20100419.1)
ProcEnviron:
 PATH=(custom, user)
 LANG=en_GB.utf8
 SHELL=/bin/bash
SourcePackage: pulseaudio
dmi.bios.date: 08/14/2008
dmi.bios.vendor: Dell Inc.
dmi.bios.version: A08
dmi.board.name: 0TP412
dmi.board.vendor: Dell Inc.
dmi.chassis.type: 7
dmi.chassis.vendor: Dell Inc.
dmi.modalias: 
dmi:bvnDellInc.:bvrA08:bd08/14/2008:svnDellInc.:pnPrecisionWorkStationT3400:pvr:rvnDellInc.:rn0TP412:rvr:cvnDellInc.:ct7:cvr:
dmi.product.name: Precision WorkStation T3400
dmi.sys.vendor: Dell Inc.

** Affects: pulseaudio (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug maverick

-- 
pa_simple_drain() takes over 2 seconds to complete!
https://bugs.launchpad.net/bugs/660567
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to