Bug 265317 - list of streams slowly grows in kmix playback tab
Summary: list of streams slowly grows in kmix playback tab
Alias: None
Product: kmix
Classification: Applications
Component: Backend: Pulseaudio (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Colin Guthrie
Depends on:
Reported: 2011-02-03 18:19 UTC by Oliver Henshaw
Modified: 2011-04-03 14:07 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:

kmix profile file from paplay stress text. (12.79 KB, text/plain)
2011-02-03 18:36 UTC, Oliver Henshaw

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Henshaw 2011-02-03 18:19:52 UTC
Version:           unspecified (using KDE 4.6.0) 
OS:                Linux

First observed in "Breaking the Tower" ( http://www.mojang.com/notch/ld12/breaking/ ) - a java game with no soundtrack but frequent short-lived sound events. The kmix playback tab contains "ALSA plug-in [java]:
ALSA playback" which is constantly flickering. Every so often an extra copy of this stream appears in the playback list; only the lowermost copy flickers and the others stay constant. The extra copies remain even after the stream has stopped playing and the originating java process has gone away.

If I run kmix in the console I see the message
"kmix(16151): MixDevice::setId(" "stream: " ") . Invalid key - it might not contain spaces"
when the extra stream appears.

I do not see these extra duplicate streams in pavucontrol and they do not reappear immediately when restarting kmix, but they do persist when restarting pulseaudio and keeping kmix open.

Package affected:

Originally saw this in Fedora 13 with:

Reproducible: Always
Comment 1 Oliver Henshaw 2011-02-03 18:36:17 UTC
Created attachment 56829 [details]
kmix profile file from paplay stress text.

Java behaves better in F15/KDE 4.6, but I found another way to reproduce:

'while true; do paplay /usr/share/sounds/KDE-Sys-Log-Out.ogg; done' with kmix on the console. Eventually the message quoted above will appear, and opening the kde mixer I see two copies of the stream in the playback tab.

Note that only in kde 4.6 does kmix have the profile xml files so I'm fairly sure that this isn't related to bug #264292. That said, I've attached the profile file from the reproducer in this comment in the hopes that it's useful.

I notice that at least one of the streams has spaces despite them being filtered out in kmix. It seems to contain a lot of unique stream names given that I'm spamming the same program over and over again, but maybe that's normal?

Packages tested:

Comment 2 Panagiotis Papadopoulos 2011-03-25 13:40:18 UTC
confirmed on Arch Linux, KDE 4.6.1
Comment 3 Colin Guthrie 2011-03-25 14:39:25 UTC
FWIW there are several bug reports about this. It's all the same root cause. The profiles in KMix don't really fit with PA and need to be disabled when PA is in use.

I've not had time to look at that yet but will try to do so soon.
Comment 4 Colin Guthrie 2011-03-27 14:23:16 UTC
I've probably fixed this in my tree, but waiting for Christian to review them before committing.

If you are keen you can grab my patches from here: http://colin.guthr.ie/git/kdemultimedia-trunk/log/
Comment 5 Panagiotis Papadopoulos 2011-03-27 18:58:06 UTC
compiled your git repo, will test and report back :-)
Comment 6 Panagiotis Papadopoulos 2011-03-30 18:46:43 UTC
this bug seems fixed with the patches from your git repo.
Haven’t seen this happen for 3 days now :-)
Comment 7 Colin Guthrie 2011-03-30 23:46:40 UTC
Awesome! Thanks for testing :) As I do PA development I tend to restart and fiddle with things too much for a proper burn in!

I'll get them pushed out tomorrow.
Comment 8 Colin Guthrie 2011-04-03 13:47:36 UTC
SVN commit 1226943 by cguthrie:

kmix: Do not allow 'channel configuration' with PulseAudio.

When the mixer is 'dynamic', configuring the channels is problematic and leads to some strange problems.
This is step one on masking that functionality when used with PA.

CCBUG: 265317
CCBUG: 237239
CCBUG: 264835

 M  +6 -0      apps/kmix.cpp  
 M  +5 -0      gui/viewbase.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1226943
Comment 9 Colin Guthrie 2011-04-03 13:47:38 UTC
SVN commit 1226944 by cguthrie:

kmix: Various UTF8 encoding fixes.

This ensures that data that can be UTF8 is treated as such.
Another important fix is the use of QString::number() in the stream names.

Using the number is not great in the first place but the mixer ids need
to be unique. The downside of this is that you cannot split the
channels of a stream and expect it to be restored again (it will be
restored after a reboot but only when the stream indexes match up).

Some better plan is needed here.

That said, this should help restore problems with profiles encountered
with locales that need UTF8 encoding which should also hopefully
help the memory leak that results from this.

However, profile support will still be disabled with PulseAudio backend
anyway, so it shouldn't matter much.

CCBUG: 265317
CCBUG: 237239
CCBUG: 264835

 M  +28 -23    mixer_pulse.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1226944
Comment 10 Colin Guthrie 2011-04-03 13:47:40 UTC
SVN commit 1226945 by cguthrie:

kmix: Avoid the use of QString.sprintf().

This is generally discouraged and also doesn't deal gracefully with UTF8
encoded data (due to explicityly calling toAscii()) so use the
more modern QString().arg(..) construct and leave the data encoding
as is. This may result in writing some UTF8 data into the config files
but this should be handled gracefully.

CCBUG: 265317
CCBUG: 237239
CCBUG: 264835

 M  +3 -4      core/mixdevice.cpp  
 M  +7 -7      gui/viewbase.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1226945
Comment 11 Colin Guthrie 2011-04-03 13:47:43 UTC
SVN commit 1226946 by cguthrie:

kmix: Do not save/load mixer profiles for dynamic mixers (e.g. PulseAudio)

These mixer profiles are just 'odd' when it comes to PA, especially the streams (as opposed to devices).
When used under plain ALSA mixer profiles make sense to hide the unecessary complexity
of ALSA from most users, but PA already hides that complexity and building a filter
system on top of that makes little sense and leads to strange bugs/configurations.

CCBUG: 265317
CCBUG: 237239
CCBUG: 264835

 M  +22 -4     apps/kmix.cpp  
 M  +5 -1      gui/guiprofile.cpp  
 M  +13 -2     gui/viewbase.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1226946
Comment 12 Colin Guthrie 2011-04-03 13:47:44 UTC
SVN commit 1226947 by cguthrie:

kmix: As we no longer allow editing of GUI Profiles for dynamic mixers, be sure to kill the 'Hide' context menu item too.

CCBUG: 265317
CCBUG: 237239
CCBUG: 264835

 M  +5 -1      mdwslider.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1226947
Comment 13 Colin Guthrie 2011-04-03 13:47:47 UTC
SVN commit 1226948 by cguthrie:

kmix: Kill off GUI Profile tweaks for dynamic mixers.

Now that dynamic mixers *always* use the fallback profile, we know that we don't have to
do any special fixups to display totally new devices/streams as we can be confident
the fallback GUI Profile will show them.

CCBUG: 265317
CCBUG: 237239
CCBUG: 264835

 M  +0 -36     viewbase.cpp  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1226948
Comment 14 Colin Guthrie 2011-04-03 13:47:48 UTC
SVN commit 1226949 by cguthrie:

kmix: Generify an earlier fix to not show close/new tab buttons with PulseAudio.

This just removes the specific PulseAudio check and relies on the 'dynamic' mixers
In theory the same logic could apply to OSSv4 but I doubt anyone will bother.

Also remove the option to Launch pavucontrol. There is no check to see if it is
installed and all the functionality of pavucontrol is now available in kmix
or Speaker Setup which is already linked to in the menu.

CCBUG: 265317
CCBUG: 237239
CCBUG: 264835

 M  +9 -18     apps/kmix.cpp  
 M  +0 -1      apps/kmix.h  
 M  +0 -1      kmixui.rc  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1226949
Comment 15 Colin Guthrie 2011-04-03 13:58:00 UTC
SVN commit 1226958 by cguthrie:

kmix: Various (mostly PulseAudio related) fixes from trunk.

Merges r1225537 through r1226957.

CCBUG: 237239
CCBUG: 265317
CCBUG: 264835

 M  +37 -22    apps/kmix.cpp  
 M  +0 -1      apps/kmix.h  
 M  +2 -2      backends/mixer_backend.cpp  
 M  +57 -32    backends/mixer_pulse.cpp  
 M  +7 -9      core/mixdevice.cpp  
 M  +2 -13     core/mixdevice.h  
 M  +1 -1      core/mixer.cpp  
 M  +1 -1      core/mixer.h  
 M  +5 -1      gui/guiprofile.cpp  
 M  +11 -7     gui/mdwslider.cpp  
 M  +30 -48    gui/viewbase.cpp  
 U             gui/viewbase.h  
 M  +7 -7      gui/viewdockareapopup.cpp  
 M  +0 -3      gui/viewdockareapopup.h  
 M  +1 -1      gui/viewsliders.cpp  
 M  +0 -1      kmixui.rc  

WebSVN link: http://websvn.kde.org/?view=rev&revision=1226958
Comment 16 Colin Guthrie 2011-04-03 14:07:23 UTC
OK, I think this can now be closed :)

Fingers crossed it'll not reoccur.