[pulseaudio-tickets] [PulseAudio] #866: pa_simple_drain() takes much longer (about 2000ms) than expected to complete
PulseAudio
trac-noreply at tango.0pointer.de
Thu Oct 14 13:05:23 PDT 2010
#866: pa_simple_drain() takes much longer (about 2000ms) than expected to
complete
---------------------+------------------------------------------------------
Reporter: th | Owner: lennart
Type: defect | Status: new
Milestone: | Component: libpulse
Resolution: | Keywords:
---------------------+------------------------------------------------------
Description changed by coling:
Old description:
> 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 with the version that ships with Ubuntu 10.10, it waits a *fair*
> bit more than that, approximately 2 seconds (see below). This is also the
> case for Fedora 14 according to a user on IRC who confirmed this issue,
> hence I am reporting it here.
>
> 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 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 have also reported this on Ubuntu's bug tracker:
> [https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/660567]
New description:
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 with the version that ships with Ubuntu 10.10, it waits a *fair*
bit more than that, approximately 2 seconds (see below). This is also the
case for Fedora 14 according to a user on IRC who confirmed this issue,
hence I am reporting it here.
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 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 have also reported this on Ubuntu's bug tracker:
[https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/660567]
--
--
Ticket URL: <http://pulseaudio.org/ticket/866#comment:5>
PulseAudio <http://pulseaudio.org/>
The PulseAudio Sound Server
More information about the pulseaudio-bugs
mailing list