# HG changeset patch # User reimar # Date 1197738606 0 # Node ID bd46b759fd3588eabc5d321a3f7a10e691aa0b94 # Parent 52f6c42c43bbeb15a9f414269cd4bd452c901d0b pa_stream_write reportedly needs locking of the main loop (could not find official documentation on this subject...) diff -r 52f6c42c43bb -r bd46b759fd35 libao2/ao_pulse.c --- a/libao2/ao_pulse.c Sat Dec 15 17:07:40 2007 +0000 +++ b/libao2/ao_pulse.c Sat Dec 15 17:10:06 2007 +0000 @@ -256,10 +256,12 @@ /** Play the specified data to the pulseaudio server */ static int play(void* data, int len, int flags) { + pa_threaded_mainloop_lock(mainloop); if (pa_stream_write(stream, data, len, NULL, 0, PA_SEEK_RELATIVE) < 0) { GENERIC_ERR_MSG(context, "pa_stream_write() failed"); - return -1; + len = -1; } + pa_threaded_mainloop_unlock(mainloop); return len; }