I didn't find any reason to do it, and it slows closing quite a lot,
if you know why we should do that, please speak up etc.
pa_threaded_mainloop_lock(p_sys->mainloop);
pa_stream_set_write_callback(p_sys->stream, NULL, NULL);
pa_threaded_mainloop_lock(p_sys->mainloop);
pa_stream_set_write_callback(p_sys->stream, NULL, NULL);
+/* I didn't find any explanation why we need to do pa_stream_drain on close
+ * as we don't really care if we lose 20ms buffer in this point anyway?
+ * And disabling this speeds up closing pulseaudio quite a lot (atleast for me).
+ */
+#if 0
if((o = pa_stream_drain(p_sys->stream, success_cb, p_aout))){
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
CHECK_DEAD_GOTO(fail);
if((o = pa_stream_drain(p_sys->stream, success_cb, p_aout))){
while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
CHECK_DEAD_GOTO(fail);
pa_threaded_mainloop_unlock(p_sys->mainloop);
}
uninit(p_aout);
pa_threaded_mainloop_unlock(p_sys->mainloop);
}
uninit(p_aout);