Bug 279448 - knotify4 blocks sound, when killed sounds goes back to normal
Summary: knotify4 blocks sound, when killed sounds goes back to normal
Status: RESOLVED FIXED
Alias: None
Product: phonon-backend-gstreamer
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 4.5.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: 4.5.1
Assignee: Harald Sitter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-05 13:05 UTC by Gabriel Trisca
Modified: 2012-09-28 08:12 UTC (History)
7 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 Gabriel Trisca 2011-08-05 13:05:25 UTC
Version:           unspecified (using KDE 4.7.0) 
OS:                Linux

After upgrade to 4.7 via Ubuntu backports, the sound stopped working. Reading around in forums some people recommended doing an "lsof /dev/SOMETHING" and they concluded that knotify4 was locking this device and therefore there was no sound. I killed the only instance of knotify4 that was running, and immediately the sound worked, all the programs that were open and playing something started playing at once.
I tried to find again what device they were refering to, but I couldn't find it.

Reproducible: Didn't try

Steps to Reproduce:
Update to 4.70

Actual Results:  
There was no sound (and no errors)

Expected Results:  
Sound should play through the sppeakers

OS: Linux (x86_64) release 2.6.38-10-generic
Compiler: gcc
Comment 1 Torrie Fischer 2011-08-05 15:54:51 UTC
Unfortunately, this bug report is rather unhelpful without some more information:

* What version of Phonon are you using?
* What Phonon backend
* What version of that phonon backend
* If its GStreamer, what version gstreamer packages do you have
* If its VLC, what version VLC
* Do you have pulseaudio enabled/running, and what version if so
* What distribution
Comment 2 Gabriel Trisca 2011-08-05 16:02:36 UTC
I don't even know if its Phonon's fault, but here is the info:

> * What version of Phonon are you using?
I don't know how to check the exact version of Phonon, the package manager calls it: "4.7.0" (full name "4.7.0really4.5.0-0ubuntu3" amd64)
> * What Phonon backend
GStreamer
> * What version of that phonon backend
4.5 according to the "Multimedia" section in System Settings
> * If its GStreamer, what version gstreamer packages do you have
Again, I don't know how to check for that, but according to the pkg manager its 0.10.32
> * Do you have pulseaudio enabled/running, and what version if so
Yes, pulseaudio 0.9.22-24-g67d18
> * What distribution
Kubuntu 11.04, installed KDE 4.7 through backports

Thanks a lot for taking this bug :)
Comment 3 Franz Trischberger 2012-05-10 06:45:55 UTC
I think, I suffer from the same problem.
I am running phonon-4.6.0, phonon-gstreamer-4.6.0, kde-4.8.3.

phonon is locking the audiodevice. When amarok (also tried with the qt phonon-demos) is running, no other application can use the sound-device. vlc prompts the following message:
Audio output failed:
The audio device "default" could not be used:
Device or resource busy.

When one phonon-application is running and I open another one, knotify tells me:
The audio playback device hw:0,0 does not work.
Falling back to hw:0,0.

And then it works (note that both devices are labeled with "hw:0,0", which is somewhat confusing).
Running several non-phonon applications at the same time works without a problem, they all play sound at the same time.
phonon-vlc also works (but produces crappy sound, though vlc itself sounds nice), so it is an issue within phonon-gstreamer.

AFAIR this behaviour started after the move from oss4 to alsa, but I will have to test this another time (needs recompilations + reboot, can't do that ATM).
Comment 4 Myriam Schweingruber 2012-05-10 10:42:47 UTC
Setting status to confirmed.
Comment 5 Colin Guthrie 2012-05-10 10:56:37 UTC
knotify has a bad habit of hogging the sound device.

My recommendations:
 1. Use PulseAudio
 2. Make sure your Phonon is bullt with PulseAudio support
 3. Make sure the start-pulseaudio-kde script is run at login (it should happen automatically via xdg autostart files).
 4. Ensure the 'default' alsa device is configured to use the ALSA plugin for PulseAudio
 5. Configure everything to use PulseAudio directly if possible, or the 'default' ALSA device if not.
 6. Patch knotify to use libcanberra for sounds (http://colin.guthr.ie/git/kde-runtime/log/?h=canberra)

This is the setup we use by default in Mageia and i've never had any bug relating to sound device hogging etc.
Comment 6 Franz Trischberger 2012-05-10 12:08:36 UTC
Installing pulseaudio just to workaround an issue inside another part of the stack is not an option. I had it on my system some time ago and it messed up quite a lot (no sound, stuttering sound, extremely increased CPU usage...).
Especially I don't need it's features - I simply need sound playback. Alsa has dmix, so I don't need another Software Mixer for simultanious playback.
If this can't be fixed (what I can't believe) I am back to oss4.
Comment 7 Franz Trischberger 2012-05-10 12:21:45 UTC
(In reply to comment #3)> AFAIR this behaviour started after the move from oss4 to alsa, but I will
> have to test this another time (needs recompilations + reboot, can't do that
> ATM).

Checked this, and yes - oss4 works without a problem.
Comment 8 Colin Guthrie 2012-05-10 12:37:37 UTC
The reasons for using PA are not just to "work around this problem", but I don't have the time or inclination to list them or try and convince you here.

If you don't want to use the recommended stack, that's fine, but you'll find yourself increasingly having to solve your own problems. If that's something you are happy with, then fine, knock yourself out. That's one of the freedoms of Free software.
Comment 9 Franz Trischberger 2012-05-10 13:34:00 UTC
(In reply to comment #8)> If you don't want to use the recommended stack, that's fine, but you'll find
> yourself increasingly having to solve your own problems. If that's something
> you are happy with, then fine, knock yourself out. That's one of the
> freedoms of Free software.

I could not find any information on a "recommended stack", especially not that I have to use pulseaudio. I went to phonon.kde.org and searched google. If pulseaudio is the only way to get a working phonon-gstreamer-setup ATM. then why is it just optional?

If you won't fix this, could you at least show me, where I should look at (class/method/lines in the code/...), so at least I could try to make it work for me?
Comment 10 Franz Trischberger 2012-05-17 12:27:28 UTC
My issues are fixed. I just used the wrong playback device. When I last setup phonon, there was no "default" device, and the only working device was "hw0,0". Now I went back to the settings, chose "default" for all entries - and all blocks are gone. When I start with a completely empty $HOME, "default" is not the default, but "HDA Intel PCH (ALC892 Analog)", which causes the same problems as "hw0,0".
The question that remains: which part of the stack creates and exposes those devices and its order? Is it just the alsa-config?
Comment 11 Torrie Fischer 2012-09-22 18:17:23 UTC
(In reply to comment #9)
> (In reply to comment #8)> If you don't want to use the recommended stack,
> that's fine, but you'll find
> > yourself increasingly having to solve your own problems. If that's something
> > you are happy with, then fine, knock yourself out. That's one of the
> > freedoms of Free software.
> 
> I could not find any information on a "recommended stack", especially not
As the phonon-gstreamer maintainer, the officially recommended stack is to use pulseaudio.

> that I have to use pulseaudio. I went to phonon.kde.org and searched google.
> If pulseaudio is the only way to get a working phonon-gstreamer-setup ATM.
> then why is it just optional?

Because PulseAudio has previously left a bad taste in users' mouths due to:

* Bad default configuration
* Bad distribution packaging
* Applications that insisted on competing with PulseAudio via direct hardware access
* The misconception that free software is about choice and developers forcing PulseAudio onto users somehow invalidates their choice.

> 
> If you won't fix this, could you at least show me, where I should look at
> (class/method/lines in the code/...), so at least I could try to make it
> work for me?

There is no one location to 'fix' this. Here's a list of the parties involved:

* Phonon-GStreamer
* GStreamer
* PulseAudio
* userland libalsa
* Kernelspace ALSA
* Your ALSA driver
* Other applications that demand raw hardware access outside of the "safe" ALSA api.

WIthout PulseAudio, there is nothing to mediate which application has exclusive access to the audio devices.

> The question that remains: which part of the stack creates and exposes those devices and its order? Is it just the alsa-config?

Depends on your setup. If you're using PulseAudio, that'd be libphonon's PulseSupport class. Otherwise, it'd be the result of a property probe from within phonon-gstreamer on the underlying GStreamer element (alsasink, pasink, osssink, etc).

Since you say the problem is fixed, I'm closing the bug.
Comment 12 Aleksey Kontsevich 2012-09-24 09:12:07 UTC
Still has this problem in 4.8.5 EVERY TIME I start kde. I'm using openSUSE. Killing knotify restores sound to normal.
Comment 13 Aleksey Kontsevich 2012-09-24 09:13:40 UTC
Please reopen bug.
Comment 14 Myriam Schweingruber 2012-09-24 10:30:59 UTC
(In reply to comment #13)
> Please reopen bug.

Well, you should be more precise on what exact versions of the mentioned stacks involved you use, the information you have given so far is not enough to reopen this. Please see comment #11
Comment 15 Aleksey Kontsevich 2012-09-24 13:57:19 UTC
I do not use PulseAudio, removed it from PC. What else should I check?
Comment 16 Myriam Schweingruber 2012-09-24 14:17:34 UTC
(In reply to comment #15)
> I do not use PulseAudio, removed it from PC. What else should I check?

As I said before, please provide all the versions of the packages mentioned in comment @11. And as mentioned by Trever in comment #11, using pulseaudio is the recommended way.
Comment 17 Aleksey Kontsevich 2012-09-24 14:56:14 UTC
phonon-backend-gstreamer-0_10-4.5.1-5.1.2.x86_64
libgstreamer-0_10-0-0.10.36-7.1.x86_64
libgstreamer-0_10-0-32bit-0.10.35-4.1.4.x86_64
pulseaudio-module-x11-1.1-1.2.x86_64
libpulse0-32bit-1.1-1.2.x86_64
libpulse-mainloop-glib0-1.1-1.2.x86_64
libpulse0-1.1-1.2.x86_64
alsa-1.0.24.1-23.1.2.x86_64
alsa-plugins-pulse-32bit-1.0.24-18.1.2.x86_64
Comment 18 Myriam Schweingruber 2012-09-26 10:12:56 UTC
(In reply to comment #17)
> phonon-backend-gstreamer-0_10-4.5.1-5.1.2.x86_64

Your phonon-backend-gstreamer package is completely outdated, please upgrade, the latest stable version is 4.6.2
Comment 19 Aleksey Kontsevich 2012-09-26 10:29:52 UTC
Updated, and some KDE packages was not updated to 4.8.5, will monitor if bug returns for a few days.
Comment 20 Aleksey Kontsevich 2012-09-28 08:12:47 UTC
Seems fixed, thanks.