Bug 337034

Summary: Knotification should use PA directly when available
Product: [Frameworks and Libraries] frameworks-knotifications Reporter: Cédric Bellegarde <web>
Component: generalAssignee: Martin Klapetek <mklapetek>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: cfeck, jlp, kde.kfoar, kdelibs-bugs, silvan.calarco, sitter
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Cédric Bellegarde 2014-07-04 08:34:33 UTC
KDE 4 and KDE 5 use phonon for playing notification and so are unable to use media.role=event PulseAudio property.

This create weird bug like this:
https://bugs.kde.org/show_bug.cgi?id=324975

Reproducible: Always

Steps to Reproduce:
1. Mute notification volume in kmix
2. play a KDE notification
Actual Results:  
Knotity play sound

Expected Results:  
No sound

Two solution:
- Use PA when available in notifybyaudio.cpp
- Patch PulseAudio (if not already available) to be able to set PA properties

Temp fix, use this script as external notification executable:
$ cat /usr/local/bin/notify.sh 
#!/bin/bash
paplay --property="media.role=event" "$@"
Comment 1 Christoph Feck 2014-07-04 14:02:31 UTC
Isn't Phonon our abstraction layer? What needs to be changed in Phonon, so that applications do not need to use PA directly?
Comment 2 Cédric Bellegarde 2014-07-07 12:18:00 UTC
A way to pass PA properties.
Comment 4 Harald Sitter 2014-07-08 08:32:42 UTC
Oh and in case you want to fix this in an multimedia library independent way here is the api proposal that needs implementing to provide a cache based playback (which in turn internally could use pulseaudio directoy as pulseaudio provides a sample cache api already).

http://markmail.org/thread/3yysp76oz7zjyr3t#query:+page:1+mid:3yysp76oz7zjyr3t+state:results
Comment 5 Harald Sitter 2014-07-08 08:35:16 UTC
s/directoy/directly fwiw ^^
Comment 6 Christoph Feck 2014-07-08 14:50:19 UTC
knotify requests Phonon::NotificationCategory for its audio output from Phonon. If I understand comment #3 correctly, Phonon already has support for passing the category down to pulseaudio.

If this does not work correctly, the bug is either in Phonon, or in pulseaudio. Marking as NEEDSINFO, until someone clarifies the status of this bug.
Comment 7 Harald Sitter 2014-07-08 21:01:06 UTC
Pulseaudio bug I say. I briefly talked with Colin Guthrie about this a while ago. What happens (and this only ever affects the vlc backend because of the videolan bug I mentioned in comment #3) is that phonon defines override variables in the envrionment before letting vlc create the pulseaudio sink. However pulseaudio then incorrectly merges the diverging data incorrectly, giving the data that vlc provides preference over the override which ultimately sets the role to video and not whatever was set by phonon.
This then bypasses the notification volume set in kmix as that doesn't apply to video role sinks and that's why it uses volume 1.0.
Comment 8 Christoph Feck 2014-07-09 07:31:41 UTC
Thanks for the update. In other words, what knotify does is correct, and does not need to be changed.