Bug 395466 - plasma-pa mishandles virtual streams, creates issues with PulseEffects
Summary: plasma-pa mishandles virtual streams, creates issues with PulseEffects
Status: RESOLVED FIXED
Alias: None
Product: plasma-pa
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: David Rosca
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-15 23:27 UTC by Filip Fila
Modified: 2018-06-26 08:56 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.13.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Fila 2018-06-15 23:27:31 UTC
Hello there,

unlike users of other DEs, Plasma users currently have some issues when using an audio effects app PulseEffects.  This app relies on using two virtual streams "PulseEffects (apps)" and "PulseEffects (mic). There's three observable issues:

1. PulseEffects is started on the wrong outputs; instead of Built-in Analog Stereo, playback will start on e.g. PulseEffects(mic). This means there is no sound and PulseEffects does not work! The user has to go into pavucontrol and fix this.
2. The PulseEffects recording stream will be switched to a wrong output once audio playback finishes. This means you have to go to pavucontrol and switch it every time you play a new song. 
3. The levels of both PulseEffects streams, which should always be kept at 100%, get messed up by volume keys because plasma-pa allows this at certain and specific times. This means you may get quieter audio when using PulseEffects than when not.

Now the first two issues are highly likely related to a bug with the 'device-manager' module which *should* be resolved in PulseAudio 12 and a temporary workaround for Plasma users is to unload the module (discussed here: https://github.com/wwmm/pulseeffects/issues/99). But the third issue seems to be specifically related to plasma-pa and not KDE itself because it does not occur with KMix, which means using KMix is the workaround for this problem for now. For some reason, plasma-pa will allow volume keys to alter the levels of PulseEffects virtual streams, even when Built-In Analog Audio is clearly set as the default output device. For me there's always a sure shot way of reproducing this:

1. PulseEffects' two virutal streams need to be loaded, the program itself can actually be turned off and doing nothing
2. Play a song in Youtube and stop its playback.
3. Open a new song in a new tab, led it load fully, but do not switch to this tab yet.
4. plasma-pa is now affecting either PulseEffect(apps) or PulseEffects (mic) via volume keys!
5. Now you go play the tab and it's back to properly affecting Built-in Analog Stereo

Here is a verbose (level 4) PulseAudio log of when this precise thing happens: https://github.com/wwmm/pulseeffects/files/2103997/pulseeffects_issue235-3.txt

And this is the thread where the bug was reported with PulseEffects first, the author states there is no code in PulseEffects to cause this: https://github.com/wwmm/pulseeffects/issues/235

Some more troubleshooting can be found there, but I'd be happy to provide any other information I can.  And sorry for the long report, it's quite a specific issue so I felt like I had to explain everything related to it :)

P.S - this was mentioned in the github thread, but toggling the 'Automatically switch all running streams when a new output becomes available' option makes no difference.
Comment 1 David Rosca 2018-06-16 10:59:57 UTC
1. + 2. are bugs in device manager as you said, not plasma-pa.

3. should be fixed with https://phabricator.kde.org/D13568
Comment 2 Filip Fila 2018-06-16 12:11:12 UTC
(In reply to David Rosca from comment #1)
> 1. + 2. are bugs in device manager as you said, not plasma-pa.
> 
> 3. should be fixed with https://phabricator.kde.org/D13568

That's awesome! Thank you for such a quick reply and fix. I can also test it in 5.13.1 and then report back.
Comment 3 David Rosca 2018-06-26 08:36:19 UTC
Git commit 974bd408f719aeb7640b522d2813f314b5535306 by David Rosca.
Committed on 26/06/2018 at 08:35.
Pushed by drosca into branch 'Plasma/5.13'.

SinkModel: Ignore virtual sinks for preferredSink

Preferred sink is used for volume control with media keys,
so it should be controlling real hardware volume instead of
virtual devices.
FIXED-IN: 5.13.1

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

M  +5    -0    src/device.cpp
M  +10   -0    src/device.h
M  +1    -1    src/pulseaudio.cpp

https://commits.kde.org/plasma-pa/974bd408f719aeb7640b522d2813f314b5535306