summaryrefslogtreecommitdiff
path: root/src/pulsecore/source.h
diff options
context:
space:
mode:
authorTanu Kaskinen <tanuk@iki.fi>2016-03-13 14:06:02 +0200
committerTanu Kaskinen <tanuk@iki.fi>2016-04-25 13:47:13 +0300
commit13fc8333873b5cfd5f42abf0b6071bb028d9f096 (patch)
treec033c5eda5cc106edcf7522ee2adbdcb54eb04d5 /src/pulsecore/source.h
parent0b6e4694a5a421cfc9eff0c0d259e46dc007f6b0 (diff)
downloadpulseaudio-13fc8333873b5cfd5f42abf0b6071bb028d9f096.tar.gz
don't move streams to devices that are going away
Before a device is unlinked, the unlink hook is fired, and it's possible that a routing module tries to move streams to the unlinked device in that hook, because it doesn't know that the device is being unlinked. Of course, the unlinking is obvious when the code is in an unlink hook callback, but it's possible that some other module does something in the unlink hook that in turn triggers some other hook, and it's this second hook where the routing module may get confused. This patch adds an "unlink_requested" flag that is set before the unlink hook is fired, and moving streams to a device with that flag set is prevented. This patch is motivated by seeing module-device-manager moving a stream to a sink that was being unlinked. It was a complex case where an alsa card was changing its profile, while an echo-cancel sink was connected to the old alsa sink. module-always-sink loaded a null sink in the middle of the profile change, and after a stream had been rescued to the null sink, module-device-manager decided to move it back to the old alsa sink that was being unlinked. That move made no sense, so I came up with this patch.
Diffstat (limited to 'src/pulsecore/source.h')
-rw-r--r--src/pulsecore/source.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index 19fb41bd5..91e8674b7 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -64,6 +64,12 @@ struct pa_source {
pa_core *core;
pa_source_state_t state;
+
+ /* Set in the beginning of pa_source_unlink() before setting the source
+ * state to UNLINKED. The purpose is to prevent moving streams to a source
+ * that is about to be removed. */
+ bool unlink_requested;
+
pa_source_flags_t flags;
pa_suspend_cause_t suspend_cause;