diff libao2/ao_pulse.c @ 29118:17c6a6c192a7

Also lock the mainloop when doing adjusting the volume for PulseAudio. Patch by Lennart Poettering [lennart poettering net]
author reimar
date Thu, 09 Apr 2009 20:07:26 +0000
parents 010781e92294
children 52afd0fe451b
line wrap: on
line diff
--- a/libao2/ao_pulse.c	Thu Apr 09 20:04:24 2009 +0000
+++ b/libao2/ao_pulse.c	Thu Apr 09 20:07:26 2009 +0000
@@ -392,12 +392,15 @@
                 volume.values[1] = (pa_volume_t)vol->right*PA_VOLUME_NORM/100;
             }
 
+            pa_threaded_mainloop_lock(mainloop);
             if (!(o = pa_context_set_sink_input_volume(context, pa_stream_get_index(stream), &volume, NULL, NULL))) {
+                pa_threaded_mainloop_unlock(mainloop);
                 GENERIC_ERR_MSG(context, "pa_context_set_sink_input_volume() failed");
                 return CONTROL_ERROR;
             }
             /* We don't wait for completion here */
             pa_operation_unref(o);
+            pa_threaded_mainloop_unlock(mainloop);
             return CONTROL_OK;
         }