Bug 301069 - starting phonon configuration the first time speeds up sound
Summary: starting phonon configuration the first time speeds up sound
Status: RESOLVED WORKSFORME
Alias: None
Product: Phonon
Classification: Frameworks and Libraries
Component: settings (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: 4.6.1
Assignee: Harald Sitter
URL:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2012-06-02 18:21 UTC by Stefan Lithén
Modified: 2018-10-27 03:57 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Lithén 2012-06-02 18:21:53 UTC
When starting phonon configuration the first time after KDE i started and I am playing sound, it speeds up the sound and I have to hit the stop button and wait a few secounds before I can play again in normal speed.

Same thing happends everytime another user is trying to play music the same time my normal user plays sound.

Soundcard is 'Creative Labs CA0106 Soundblaster' using KDE with ubuntu 12.04 64-bit.
Changeing backend to Phonon does not help.

Reproducible: Always

Steps to Reproduce:
1. Start KDE
2. Play some music in Audacious
3. open "audio setup" from kmix

This does not happen in my laptop so this will not happen for eveyone.
Actual Results:  
Sound gets speeded up

Expected Results:  
No effect on my playing sound
Comment 1 Harald Sitter 2012-06-02 19:08:12 UTC
does that happen without audacious?
Comment 2 Stefan Lithén 2012-06-02 19:34:52 UTC
yes, also amarok for example.

when I enter systemsettings -> multimedia and then choose the phonon icon is happends, and also KDE says [modified] wihout me having done any modification in the sound settings. Have not even clicked around.

If I look in amarok I see that the time scale is moving faster so it is actually playing faster (not only does it sound like it does).
Comment 3 Stefan Lithén 2012-06-02 19:49:58 UTC
Everything works great in gnome/unity which also uses pulsaudio.

I tested now to start systemsettings (the KDE application) from gnome-terminal and navigated to multimedia and pressed phonon icon and it did the same thing (speeded up the music).

Could it be that phonon does something to my sound card? Initializes something or so? Since it does not happen for others and also not on my laptop but it happens on this machine no matter if it is a fresh install of kubuntu or KDE installed after a ubuntu (gnome/unity) install.

I have also tried to disable my internal sound card so it is not that that's interfering.
Comment 4 Harald Sitter 2012-06-02 19:53:22 UTC
possible

http://techbase.kde.org/Development/Tutorials/Debugging/Phonon

please get complete logs of both the phonon KCM and amarok when the speed changes
Comment 5 Stefan Lithén 2012-06-02 20:26:07 UTC
output from phonon http://pastebin.com/vi9ZQ2j0
output from amarok http://pastebin.com/xxQpumHY

no extra output in terminal when the speedchange happens though.

Both these work:
$ gst-launch filesrc location=/usr/share/sounds/KDE-Sys-Log-In.ogg ! decodebin2 ! audioresample ! audioconvert ! pulsesink
$ gst-launch filesrc location=/usr/share/sounds/KDE-Sys-Log-In.ogg ! decodebin2 ! audioresample ! audioconvert ! alsasink

(though I hade to use gst-launch-0.10 as command). They can also play at the same time wityhout problem.
Comment 6 Harald Sitter 2012-06-02 20:43:04 UTC
Odd:

"PulseSupport(2): Change to Existing Output Device (may be Added/Removed or something else)"

Colin any thoughts?
Comment 7 Stefan Lithén 2012-06-02 22:38:32 UTC
Removing pulseaudio solves all issues but makes new ones in that gnome/unity do not work as it should. (volume control and more is removed because it depends on pulseaudio).

Maybe this but is not really related to phonon but insted pulseaudio in KDE. But that is maybe exactly what phonon is in charge of handeling?

Pulseaudio in gnome/unity works great.
Comment 8 Harald Sitter 2012-06-02 22:40:48 UTC
If anything in Phonon is causing this behavior, then it is the PulseAudio integration, which is why I asked for Colin's opinion as he is one of the PulseAudio devs.
Comment 9 Stefan Lithén 2012-06-02 22:41:33 UTC
Oh ok
Comment 10 Stefan Lithén 2012-06-02 23:17:21 UTC
Another info update that might be of interest:

I now tried booting a Live-CD (USB-stick) with Mageia (which uses KDE with pulseaudio), and there everything works great.
Comment 11 Harald Sitter 2012-06-02 23:18:46 UTC
Mageia uses PA 2, Ubuntu 12.04 is on PA 1.1
Comment 12 Stefan Lithén 2012-06-02 23:20:27 UTC
Okey. Someone with a simular problem tried installing PA 2 in kubuntu 12.04 without any difference. Not 100% sure we have exacly the same issue though.
Comment 13 Stefan Lithén 2012-06-03 00:43:32 UTC
I remembered correct. This goes back even to kubuntu 11.10.
Booted up with kubuntu 11.10 live-cd (USB-stick) and same error (speeded sound when selecting phonon icon in systemsettings -> multimedia)
Comment 14 Stefan Lithén 2012-06-03 13:37:51 UTC
More info.

I installed PA 2 now in ubuntu 2.04 from PPA "ppa:ubuntu-audio-dev/ppa" but still the same problem.
Comment 15 Colin Guthrie 2012-06-03 14:49:11 UTC
This is certainly a curious issue. You've already done all the debug things I'd normally ask for but the fact that GST works generally on it's own is indicative that the problem is not in either pulseaudio or gstreamer which only leaves the phonon layers on top. That said, like Harald I cannot really see any reason this would happen in phonon as it's really just an intermediate layer and certainly shouldn't have any effect on e.g. sample rate etc.

So in an attempt to get more debug, here is what I would suggest.
1. Login on a fresh boot.
2. Play some sound in audacious (which should be the correct speed) While it is playing, grab the output from "pacmd ls" and save it in a file.
3. While audacious is still playing, run the gst-launch command (via pulsesink). This should also be playing at the correct speed if I understand correctly. While both streams are still playing, grab "pacmd ls" again and save it to a file.
4. While audacious is still playing, do what you need to do to break things (ideally by playing something via phonon - e.g. with dragon or amarok) and grab the "pacmd ls" output for a third time.

Hopefully we'll start to see some sort of correlation here (perhaps in terms of sample rates etc).


If this is purely related to sample rates and the h/w being a "bit weird", then a potential solution might be to set "default-sample-rate = 48000"  (and "alternate-sample-rate = 48000" if using PA 2.0) in the /etc/pulse/daemon.conf file (or copy it to ~/.pulse/daemon.conf and edit it there).

Hope this helps us to find out where the problem lies!
Comment 16 Stefan Lithén 2012-06-03 15:03:43 UTC
1. Playing audacious right after login: http://pastebin.com/cA6CZ6Rb
2. Still playing audacious when also running gst: http://pastebin.com/FWHM236F
3. When playing audacious and opening the phonon settings: http://pastebin.com/QcmuwJmj


1. Normal speed
2. Normal speed and it's playing both songs
3. Sound speeded up the same moment I press phonon icon
Comment 17 Colin Guthrie 2012-06-03 15:33:12 UTC
Thanks for that. One interesting thing is that the card is opened at 48kHz and the song you are playing in adacious is 44.1kHz (the gst one was 48kHz). This shouldn't be a problem at all normally, but I suspect that *something* in KDE is causing the card to internally "flip" over into some different mode but in a way that pulse is unaware of.

I suspect running "pasuspender echo" would be sufficient to restore normal behaviour (as pulseaudio would close and reopen+reinit the device).

Another potential solution is to rename the "platform plugin" for phonon that is in use in KDE. On my system it's /usr/lib64/kde4/plugins/phonon_platform/kde.so but the path could be different on Ubuntu. Just rename the file out the way and reboot. Hopefully this "solves" the problem. This plugin is not really needed in a PulseAudio setup anyway, and to be honest it shouldn't be loaded by phonon when PA is detect, but I can't think anything else that could be interfering.
Comment 18 Stefan Lithén 2012-06-03 16:12:26 UTC
Moving that file file away from the path solved the issue with the speedup when choosing phonon setup icon.

I still can't play sounds as my normal user and root user at the same time though. While trying this strange things happened. The time scale in amarok (started as root) speeded up some times and later when I closed amarok (and it crached) I got the speedup for a few seconds before it setteled again and then everything worked again.

I also do not have and never had had any login/logout/notification sounds. There are a sound scheme in there but trying to play the files makes no output. It says it is using "KDE system player" or what ever that is. Maybe this is another issue though.
Comment 19 Colin Guthrie 2012-06-03 16:55:07 UTC
(In reply to comment #18)
> Moving that file file away from the path solved the issue with the speedup
> when choosing phonon setup icon.

Excellent. At least we know where it is now!

> I still can't play sounds as my normal user and root user at the same time
> though. While trying this strange things happened. The time scale in amarok
> (started as root) speeded up some times and later when I closed amarok (and
> it crached) I got the speedup for a few seconds before it setteled again and
> then everything worked again.

This should generally be OK - What should happen is that when you login, the script "start-pulseaudio-x11" should be run automatically. This includes various details on the root X11 window needed to talk to your users PA daemon. If you become root from within your user session, you should still be able to access the X11 root window to see these credentials (xprop -root | grep PULSE).

The root user should then be able to connect to the same PA instance as your regular user and you should be able to both output at the same time. This works fine here, but I do note that KDM as a login manager is not always so good at setting things up for this kind of authorisation. GDM seems a lot more refined in this regard and I've never had issues when using GDM as a login manger. 

> I also do not have and never had had any login/logout/notification sounds.
> There are a sound scheme in there but trying to play the files makes no
> output. It says it is using "KDE system player" or what ever that is. Maybe
> this is another issue though.

I've not sure about that generally, but I've always hacked up the knotify system in Mageia to use libcanberra for sounds. This works pretty well for startup and logout sounds. In Mageia you're not even offered a choice of what to use. But yes, it's very much a separate issue.
Comment 20 Stefan Lithén 2012-06-03 17:23:26 UTC
Adding the script start-pulseaudio-x11 to script to run at startup did the job as you said.
The other problem I will try asking for in #kubuntu on freenode.

Thank you very much for all the help!
Comment 21 Colin Guthrie 2012-06-03 17:50:10 UTC
(In reply to comment #20)
> Adding the script start-pulseaudio-x11 to script to run at startup did the
> job as you said.

Hmm, it should work like that out of the box. If it doesn't you should probably bug some Kubuntu folks about it. Maybe it's just an odd issue with upgrades or something, but we ship the file in such a way that it will be run at login upstream.

Glad you're making progress :)
Comment 22 Stefan Lithén 2012-06-03 18:49:41 UTC
Another update: Maybe you're not interrested but anyhow.

The no-sound for notifications where because the volume in kmix for notifications were set to 0%
But I could not change the slider (it was not greyed out or anything it just woudn't move).
So I installed pavucontrol (someone told me to try it) and there I could change the volume and then everything worked great with that also ;)
Comment 23 Colin Guthrie 2012-06-03 20:26:03 UTC
(In reply to comment #22)
> Another update: Maybe you're not interrested but anyhow.
> 
> The no-sound for notifications where because the volume in kmix for
> notifications were set to 0%
> But I could not change the slider (it was not greyed out or anything it just
> woudn't move).
> So I installed pavucontrol (someone told me to try it) and there I could
> change the volume and then everything worked great with that also ;)

Interesting... it should work. Does the kmix slider now show the right value after setting it in pavucontol? (they should be linked - I can run both kmix and pavucontrol here and moving one slider is reflected in the other app!)
Comment 24 Stefan Lithén 2012-06-04 00:56:41 UTC
Yes after i put it to 100% in pavucontrol, the slider in kmix also shows 100%.
Its like its read only for kmix.
Comment 25 Myriam Schweingruber 2013-04-13 09:06:02 UTC
What is the status of this report with a recent KDE 4.10.x installation?
Comment 26 Jean-Baptiste Kempf 2013-05-25 20:30:12 UTC
I really doubt this is a phonon bug...
Comment 27 Andrew Crouthamel 2018-09-24 02:04:13 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 28 Andrew Crouthamel 2018-10-27 03:57:32 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!