These patches fix the release blocker bug 104761. There are some smaller patches included that aren't directly related to the bug, they are just some issues around the general topic of state changing that I noticed while working on the bug. The original problem was that pa_sink_suspend() was being called from a wrong thread by the alsa sink's set_port() callback. Just changing the calling thread wouldn't have required that big changes, but there was another issue that had to be fixed too: pa_sink_suspend() was being called recursively, because pa_sink_suspend() called the set_port() callback and the set_port() callback called pa_sink_suspend(). That was not going to work. The set_port() call in pa_sink_suspend() was done to sync the mixer when the user session becomes active again after being inactive. That didn't involve actually changing the port. I could have added a sync_mixer() callback to pa_sink, to be called instead of the set_port() callback, and that would have resolved the recursion problem. That would also have required fewer changes overall, but the whole mixer syncing business in pa_sink_suspend() seemed like a bad hack that I wanted to get rid of. I decided to move the syncing to happen internally in the alsa sink, but the problem was that the alsa sink wasn't notified when the SESSION suspend cause was removed, unless the sink was also resumed at the same time. To solve that, I changed the set_state() callback and the SET_STATE message so that they would be used also when only the suspend cause changes. Then I could finally make the alsa sink handle the mixer syncing internally. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=104761 Tanu Kaskinen (8): alsa, solaris, oss: remove unnecessary error handling when suspending null-sink, pipe-sink: prefer thread_info variables in the IO thread alsa: add a couple of FIXME comments sink, source: redo state changing code pass pa_suspend_cause_t to set_state() callbacks pass pa_suspend_cause_t to SINK/SOURCE_SET_STATE handlers bluetooth: fix resume error handling fix a call to pa_sink_suspend() from an incorrect thread src/modules/alsa/alsa-sink.c | 117 ++++++++++++---- src/modules/alsa/alsa-source.c | 117 ++++++++++++---- src/modules/bluetooth/module-bluez4-device.c | 38 +++--- src/modules/bluetooth/module-bluez5-device.c | 46 ++++--- src/modules/echo-cancel/module-echo-cancel.c | 6 +- src/modules/macosx/module-coreaudio-device.c | 4 +- src/modules/module-combine-sink.c | 17 ++- src/modules/module-equalizer-sink.c | 4 +- src/modules/module-esound-sink.c | 11 +- src/modules/module-ladspa-sink.c | 4 +- src/modules/module-null-sink.c | 8 +- src/modules/module-null-source.c | 2 +- src/modules/module-pipe-sink.c | 13 +- src/modules/module-remap-sink.c | 4 +- src/modules/module-remap-source.c | 2 +- src/modules/module-sine-source.c | 2 +- src/modules/module-solaris.c | 41 +++--- src/modules/module-tunnel-sink-new.c | 12 +- src/modules/module-tunnel-source-new.c | 12 +- src/modules/module-tunnel.c | 14 +- src/modules/module-virtual-sink.c | 4 +- src/modules/module-virtual-source.c | 4 +- src/modules/module-virtual-surround-sink.c | 4 +- src/modules/oss/module-oss.c | 40 +++--- src/modules/raop/raop-sink.c | 9 +- src/pulsecore/sink.c | 188 +++++++++++--------------- src/pulsecore/sink.h | 42 +++++- src/pulsecore/source.c | 191 ++++++++++++--------------- src/pulsecore/source.h | 42 +++++- 29 files changed, 609 insertions(+), 389 deletions(-) -- 2.15.1