From 8f186a3535a4e833d34288e33fc2ff55c3f36024 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 15 Dec 2007 17:10:06 +0000 Subject: pa_stream_write reportedly needs locking of the main loop (could not find official documentation on this subject...) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25414 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_pulse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libao2/ao_pulse.c') diff --git a/libao2/ao_pulse.c b/libao2/ao_pulse.c index f94be77d5b..a2440609c8 100644 --- a/libao2/ao_pulse.c +++ b/libao2/ao_pulse.c @@ -256,10 +256,12 @@ static void uninit(int immed) { /** 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; } -- cgit v1.2.3