[Portaudio] PulseAudio Host API for Portaudio

sqweek sqweek at gmail.com
Thu Dec 17 08:29:56 EST 2015


On 16 December 2015 at 16:53, Tuukka Pasanen <pasanen.tuukka at gmail.com> wrote:
> 15.12.2015, 19:17, sqweek kirjoitti:
>>
>> 1) many times during startup it dies with "Assertion 'c->callback'
>> failed at pulsecore/socket-client.c:126, function do_call().
>> Aborting." I get this in both callback and blocking mode, regardless
>> of whether I'm actually trying to use the pulse host-api.
>
> Which version of PulseAudio do you have? Can you gdb backtrace.

I'm running pulseaudio 7.1, libpulse 7.1.0. I reproduced the crash
with pa_devs to rule out my code; the pulseaudio thread aborts during
Pa_Initialize:

Thread 7 (Thread 0x7fffef160700 (LWP 26403)):
#0  0x00007ffff69805f8 in raise () from /usr/lib/libc.so.6
#1  0x00007ffff6981a7a in abort () from /usr/lib/libc.so.6
#2  0x00007ffff5f78a05 in ?? () from /usr/lib/pulseaudio/libpulsecommon-7.1.so
#3  0x00007ffff752ca0c in pa_mainloop_dispatch () from /usr/lib/libpulse.so.0
#4  0x00007ffff752cc1c in pa_mainloop_iterate () from /usr/lib/libpulse.so.0
#5  0x00007ffff752ccc0 in pa_mainloop_run () from /usr/lib/libpulse.so.0
#6  0x00007ffff753aee6 in ?? () from /usr/lib/libpulse.so.0
#7  0x00007ffff5f855f8 in ?? () from /usr/lib/pulseaudio/libpulsecommon-7.1.so
#8  0x00007ffff6cf84a4 in start_thread () from /usr/lib/libpthread.so.0
#9  0x00007ffff6a3613d in clone () from /usr/lib/libc.so.6


Thread 1 (Thread 0x7ffff7f3d7c0 (LWP 26397)):
#0  0x00007ffff6cfa527 in __pthread_mutex_lock_full () from
/usr/lib/libpthread.so.0
#1  0x00007ffff5f8473e in pa_mutex_lock () from
/usr/lib/pulseaudio/libpulsecommon-7.1.so
#2  0x00007ffff7bc2b11 in PaPulseAudio_Initialize (hostApi=0x614108,
hostApiIndex=3)
    at src/hostapi/pulseaudio/pa_hostapi_pulseaudio.c:530
#3  0x00007ffff7bb1773 in InitializeHostApis () at src/common/pa_front.c:226
#4  Pa_Initialize () at src/common/pa_front.c:374
#5  0x0000000000400acf in main () at ./examples/pa_devs.c:110


There were three other threads waiting for various stuff, belonging to
libjack.so. I'm running jack2 (1.9.10) which I believe has some kind
of special dbus interaction with pulse audio whereby pulse releases
the sound card when it detects jack2 starting up - maybe this is
related?

I tried to test this by recompiling portaudio without jack support,
but it seems there's an issue with the configure script, as this also
disables pulse support (even using --without-jack --with-pulse).

>> 3) when using blocking mode, I hear a huge glitch every time I start the
>> stream
>
> Is it allways the same? I have to check this because I fixed this once and I
> have find it way back..
> You don't suffer clicks with ALSA I assume.

It's similar, but not exactly the same every time. Very high pitched.
No clicks with ALSA.

> application tries to keep on I try to say can you see in app what timing
> Portaudio provides?

This one is my fault. I'm getting these times from portaudio:

2015-12-17T21:08:52.825 stream.Time = 175h22m40.1875s
2015-12-17T21:08:52.840 stream.Time = 0
2015-12-17T21:08:52.907 stream.Time = 63.906997ms
2015-12-17T21:08:52.973 stream.Time = 130.186006ms
2015-12-17T21:08:53.039 stream.Time = 196.333006ms
2015-12-17T21:08:53.105 stream.Time = 262.439996ms

The first ridiculously large time was throwing my app, but I was
calling Pa_GetStreamTime before even starting the stream so probably I
deserved it :)

>> 5) Pa_Terminate takes noticeably longer to run
>
> Ok what is noticeably? This is something that I have to make working better
> because again I try
> to mimic ALSA in this and with PulseAudio it's not working very well.

Hm, this one is unreliable. A few times after closing the GUI my
program took several seconds to exit back to the shell prompt, which
I've never noticed before. But I can't reproduce it on demand; I'll
let you know if I can pin anything down.


Hopefully someone else can chime in regarding latencies, as I don't
know much about that side of portaudio.

-sqweek


More information about the Portaudio mailing list