#166: Various asserts in pulseaudio that result in mplayer crash
---+
Reporter: Stax | Owner: lennart
Type: defect| Status: new
Priority: normal| Milestone:
Component: libpulse |Severity: major
Resolution:|Keywords:
---+
Comment (by Frank Mehnert):
There is a bug in the ao_pulse.c code in the mplayer repository. The
`pa_stream_write()` call has to be protected by the mainloop lock from the
mainloop. The reason is that `pa_stream_write()` is not called from a
mainloop callback. However, I'm not entirely sure about pa_stream_trigger.
Perhaps the main developers could have a short note here. The attached
patch works fine for me:
{{{
--- ao_pulse.c (revision 25386)
+++ ao_pulse.c (working copy)
@@ -251,11 +251,16 @@
/** Play the specified data to the pulseaudio server */
static int play(void* data, int len, int flags) {
if (len) {
-if (pa_stream_write(stream, data, len, NULL, 0, PA_SEEK_RELATIVE)
0) {
+int rc;
+pa_threaded_mainloop_lock(mainloop);
+rc = pa_stream_write(stream, data, len, NULL, 0,
PA_SEEK_RELATIVE);
+pa_threaded_mainloop_unlock(mainloop);
+if (rc 0) {
GENERIC_ERR_MSG(context, pa_stream_write() failed);
return -1;
}
} else {
+pa_threaded_mainloop_lock(mainloop);
pa_operation *o = pa_stream_trigger(stream, NULL, NULL);
if (!o) {
GENERIC_ERR_MSG(context, pa_stream_trigger() failed);
@@ -263,6 +268,7 @@
}
/* We don't wait for this operation to complete */
pa_operation_unref(o);
+pa_threaded_mainloop_unlock(mainloop);
}
return len;
}
}}}
--
Ticket URL: http://www.pulseaudio.org/ticket/166#comment:2
PulseAudio http://pulseaudio.org/
The PulseAudio Sound Server
___
pulseaudio-tickets mailing list
pulseaudio-tickets@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-tickets