Bug 366149

Summary: Cannot handle pulseaudio card profile and sink change
Product: [Plasma] plasma-pa Reporter: Raman Gupta <rocketraman>
Component: generalAssignee: David Rosca <nowrep>
Status: RESOLVED FIXED    
Severity: major CC: evgom.sid, plasma-bugs, rdieter
Priority: NOR    
Version: 5.7.3   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Raman Gupta 2016-07-27 01:14:45 UTC
This is a regression in Plasma 5.7.1 relative to Plasma 5.6.5.

I have an Intel-HDA card with PulseAudio 7.1.1 on Fedora 23. My card is hooked up to both my external speakers as well as a headset. I can switch the audio from headset to speakers by using the commands:

```
pactl set-card-profile alsa_card.pci-0000_00_1b.0 output:analog-surround-40+input:analog-stereo
pactl set-sink-port alsa_output.pci-0000_00_1b.0.analog-surround-40 analog-output-lineout
amixer -c $CARD sset "Auto-Mute Mode" Disabled
amixer -c $CARD sset 'Headphone',1 100 mute
```

and vice-versa:

```
pactl set-card-profile alsa_card.pci-0000_00_1b.0 output:analog-stereo+input:analog-stereo
pactl set-sink-port alsa_output.pci-0000_00_1b.0.analog-stereo analog-output-headphones
amixer -c $CARD sset "Auto-Mute Mode" Enabled
amixer -c $CARD sset 'Headphone',1 100 unmute
```

As of Plasma 5.7.1, the above commands still work, but KDE seems to lose its connection to PulseAudio when they are run. In `.xsession-errors`, immediately upon the switch I see:

org.kde.plasma.pulseaudio: No object for name "alsa_output.pci-0000_00_1b.0.analog-surround-40"

After that point, I cannot, use the volume up/down/mute keys successfully. Though moving the sliders in the pulse-pa applet does still work.

A restart of plasma restores the connection to pulseaudio and restores the up/down/mute key functionality.

Reproducible: Always

Steps to Reproduce:
1. Change pulseaudio card profile and sink port
2. Attempt to use volume up/down/mute buttons

Actual Results:  
Volume buttons no longer work

Expected Results:  
Volume buttons should still work
Comment 1 Erick Osorio 2016-08-30 02:21:46 UTC
This happen to changing the sound card's profile from phonon.
Comment 2 David Rosca 2016-09-21 10:45:41 UTC
Git commit 270110e5520f2ea3f2f50b0dc7e5b0e0f4647e07 by David Rosca.
Committed on 21/09/2016 at 10:45.
Pushed by drosca into branch 'Plasma/5.8'.

Make sure that default devices are not null

Sometimes at the time when default sink/source change is signalled
by pa, we don't have that device in sinks/sources list yet.
Try to update default devices also when sinks/sources are added and
deleted.

Differential Revision: https://phabricator.kde.org/D2824

M  +27   -9    src/server.cpp
M  +6    -1    src/server.h

http://commits.kde.org/plasma-pa/270110e5520f2ea3f2f50b0dc7e5b0e0f4647e07