diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2019-06-10 14:18:47 +0300 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2019-06-10 14:21:59 +0300 |
commit | 7fb85e0a5bfdec339fda9f7584f65cf9ddbd50a1 (patch) | |
tree | 6454851f5f1c2457d3c0f951440d7bc30b143f69 | |
parent | 6b1719d0ed100ce5a65f28c3c4d4f3b59f3f56a0 (diff) | |
download | pulseaudio-7fb85e0a5bfdec339fda9f7584f65cf9ddbd50a1.tar.gz |
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
-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 9dc9d23b..55e9af3e 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -767,7 +767,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 854b07e7..855d3de0 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -708,7 +708,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; |