changeset 25386:bd46b759fd35

pa_stream_write reportedly needs locking of the main loop (could not find official documentation on this subject...)
author reimar
date Sat, 15 Dec 2007 17:10:06 +0000
parents 52f6c42c43bb
children 95893c0e5108
files libao2/ao_pulse.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }