alsa-sink/source: Make sure volumes are synchronised after fast user switching

Log in as user A, fast user switch to user B, let user B change
port, volume or mute status, then switch back to user A.

At this point we must make sure that the ALSA and PA volumes are
synchronised by writing to the ALSA mixer when the ALSA device
becomes available.

BugLink: https://bugs.launchpad.net/bugs/915035
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
This commit is contained in:
David Henningsson 2012-04-04 17:07:13 +02:00
parent 29e4b187a3
commit 6961d3e1c7
6 changed files with 73 additions and 4 deletions

View file

@ -1210,8 +1210,10 @@ static int ctl_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
if (!PA_SINK_IS_LINKED(u->sink->state))
return 0;
if (u->sink->suspend_cause & PA_SUSPEND_SESSION)
if (u->sink->suspend_cause & PA_SUSPEND_SESSION) {
pa_sink_set_mixer_dirty(u->sink, TRUE);
return 0;
}
if (mask & SND_CTL_EVENT_MASK_VALUE) {
pa_sink_get_volume(u->sink, TRUE);
@ -1230,8 +1232,10 @@ static int io_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) {
if (mask == SND_CTL_EVENT_MASK_REMOVE)
return 0;
if (u->sink->suspend_cause & PA_SUSPEND_SESSION)
if (u->sink->suspend_cause & PA_SUSPEND_SESSION) {
pa_sink_set_mixer_dirty(u->sink, TRUE);
return 0;
}
if (mask & SND_CTL_EVENT_MASK_VALUE)
pa_sink_update_volume_and_mute(u->sink);