diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2019-06-10 14:18:47 +0300 |
---|---|---|
committer | Felipe Sateler <fsateler@debian.org> | 2019-08-04 21:18:02 -0400 |
commit | 1197642839a621c3067c907f78d441f86e3b7c16 (patch) | |
tree | a6f4d192ad1970d377b6bb7f5fc5d8c3785672bb | |
parent | 229f4f5ab063ddb83a2398497a66f09a973a5d58 (diff) |
sink, source: Don't change suspend cause when unlinking
See the added comments for why this is necessary.
Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/667
(cherry picked from commit 7fb85e0a5bfdec339fda9f7584f65cf9ddbd50a1)
Gbp-Pq: Name sink-source-Don-t-change-suspend-cause-when-unlinking.patch
-rw-r--r-- | src/pulsecore/sink.c | 6 | ||||
-rw-r--r-- | src/pulsecore/source.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index 38e8e50..4abbbb0 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -760,7 +760,11 @@ void pa_sink_unlink(pa_sink* s) { } if (linked) - sink_set_state(s, PA_SINK_UNLINKED, 0); + /* It's important to keep the suspend cause unchanged when unlinking, + * because if we remove the SESSION suspend cause here, the alsa sink + * will sync its volume with the hardware while another user is + * active, messing up the volume for that other user. */ + sink_set_state(s, PA_SINK_UNLINKED, s->suspend_cause); else s->state = PA_SINK_UNLINKED; diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index 02ae87a..c11d89b 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -702,7 +702,11 @@ void pa_source_unlink(pa_source *s) { } if (linked) - source_set_state(s, PA_SOURCE_UNLINKED, 0); + /* It's important to keep the suspend cause unchanged when unlinking, + * because if we remove the SESSION suspend cause here, the alsa + * source will sync its volume with the hardware while another user is + * active, messing up the volume for that other user. */ + source_set_state(s, PA_SOURCE_UNLINKED, s->suspend_cause); else s->state = PA_SOURCE_UNLINKED; |