Autosuspend should be inhibited when music is streaming to others via DAAP

Bug #136604 reported by Sitsofe Wheeler
4
Affects Status Importance Assigned to Milestone
Rhythmbox
Expired
Medium
rhythmbox (Ubuntu)
Triaged
Wishlist
Ubuntu Desktop Bugs

Bug Description

Binary package hint: rhythmbox

Description of the problem:
When a computer is actively streaming music to other machines over DAAP it is inconvenient to keep poking it to prevent it from automatically turning itself off.

Steps to reproduce:
(Assuming you're on AC power and you have imported some music e.g. /usr/share/example-content/ )
1. Start
gnome-screensaver-preferences .
2. Set "Regard the computer as idle after" to 1 minute.
3. Start
gnome-power-preferences .
4. In the "On AC power" tab set the "Put computer to sleep when inactive for" time down to 2 minutes.
5. Start
rhythmbox .
6. Within rhythmbox go to Edit -> Plugins.
7. Within "Configure Plugins" ensure that DAAP music sharing is ticked. Click on the Configure... button.
8. Tick "Share my music".
9. Click Close and then Close again.
10. Use another network computer to start streaming music from the original computer via DAAP.
11. Don't touch the original computer for 2 minutes.

Expected result:
Screen on original computer to dim and be blanked, music in the midst of playing on second computer to continue playing.

Actual result:
Original computer's screen dims but around a minute later music will stop being streamed as it goes to sleep.

Additional information:
If music has never been streamed, has not actively been streamed in the past two minutes or DAAP is turned off then autosuspend should not be inhibited by rhythmbox (unless it is in party mode).

Version information:
Ubuntu Gutsy (development branch)
rhythmbox 0.11.2-0ubuntu2

Revision history for this message
TJ (tj) wrote :

If the PC is on A.C. power the preferred solution would be to set "Put computer to sleep when inactive for" to "Never".

In the 'Power Management Preferences' Help, 'Frequently Asked Questions', 8.4, it says:

"gnome-screensaver is a session daemon that monitors user input, and if the mouse has not been moved, or the keyboard been pressed then it starts a timeout. When the value of this timeout reaches the value set in gnome-screensaver-preferences, then the login is marked as 'session idle'. This is when GNOME Power Manager performs all the session idle actions such as enabling low-power mode and lowering the laptop panel brightness.

As soon as the session is marked at idle, GNOME Power Manager starts it's own 'system' timer. When the timeout set in gnome-power-preferences is reached, and the CPU load is idle, then the idle action is performed, which is usually to turn off the screen, or to suspend or hibernate."

Implementing this suggestion would need Rhythmbox to interact with the power-management features, Many of the scripts for this are distro-specific which would make implementing and maintaining such a function more difficult.

You could create a script that detects when DAAP is active and alters the sleep time-out to "Never" based on if DAAP is listening on a socket, which could be detected using netstat, and have the script run every minute from a cron job. Alternatively, you could use a wrapper script around Rhythmbox that sets the time-out to "Never" before Rhythmbox starts, and restores the original value when it Quits.

Revision history for this message
Sitsofe Wheeler (sitsofe) wrote :

TJ:
I disagree that it would be hard because my understanding is that both rhythmbox and gnome-power-manager can both use dbus to talk to each other (in fact only rhythmbox has to do the talking). This puts and end to to any gconf messing around and means if rhythmbox should die unexpectedly then your computer will still suspend (it's similar argument to the way that totem postpones the screensaver when it is playing video).

I actually set one of my desktops to autosuspend because it just saves so much power. When you consider that a typical modern desktop chews up 41W when idle versus 4-5W when doing suspend to RAM the difference is significant.

If writing a patch will guarantee this feature's inclusion in Gutsy then let me know and I'll try and bash something out tomorrow.

Revision history for this message
TJ (tj) wrote :

I wouldn't say it is 'hard' merely 'difficult' technically in the sense that the function would be best implemented in the DAAP plug-in that needs it, rather than all of Rhythmbox, and experience shows that the kind of knowledge needed for that kind of integration isn't usually present in the people coding the plug-ins. Getting it implemented there might be 'harder' (time and priorities) than a more direct work-around locally.

I agree it would be a good feature to have based on your use-case, and if you can implement it, it'd be a good lesson for everyone developing user-friendly applications at all levels.

Revision history for this message
Sitsofe Wheeler (sitsofe) wrote :

TJ:
I somewhat agree that this should go into the DAAP plugin (is that a separate package to this one in LP?) but the next question becomes what if more than one plugin needs this functionality (e.g. Virtualisation and DAAP) or something that isn't a plugin yet (Party Mode) wishes to inhibit either turning off the screen or autosuspend? Should they all do it separately (since it shouldn't have to happen often)?

Revision history for this message
Jérôme Guelfucci (jerome-guelfucci-deactivatedaccount) wrote :

Setting importance to whishlist and assigning to desktop-bugs.

Changed in rhythmbox:
assignee: nobody → desktop-bugs
importance: Undecided → Wishlist
Revision history for this message
TJ (tj) wrote :

Sitsofe: That is a good point. So in terms of an ideal solution it should be implemented as a library that *any* program can link into, with a handful of functions to disable/enable related power-management features for specific purposes.

The library would handle all the system interaction and present a consistent simple API to client applications.

I'd have to investigate the Rhythmbox plug-in structure in more depth to know whether Rhythmbox wraps/sandboxes its plug-ins or allows them to be semi-independent in their interactions with the system.

If the latter, then you could develop the simple universal library and provide a patch for DAAP initially, as well as making known the existence of the library so other authors would make use of it.

If the former it would most likely need linking into Rhythmbox and additional methods added to the 'wrapper/sandbox' that plug-ins exist in.

Revision history for this message
Sitsofe Wheeler (sitsofe) wrote :

TJ:
It's hard to say whether it would be worth building a library for apps to do suspend inhibiting because much of it is app dependent and most of it is a case of just using dbus which is a library anyway. Take a look at http://live.gnome.org/GnomePowerManager/FAQ (although be careful with the python examples - they are old and don't work on Gutsy, see http://bugzilla.gnome.org/show_bug.cgi?id=472812 ).

Supposedly rhythmbox has a plugin to some of this for local playing files already - http://svn.gnome.org/viewcvs/rhythmbox/trunk/plugins/power-manager/ . I don't think that this is working on Gutsy though (perhaps the dbus path needs updating?).

Revision history for this message
Sebastien Bacher (seb128) wrote :
Changed in rhythmbox:
status: New → Triaged
Changed in rhythmbox:
status: Unknown → New
Changed in rhythmbox:
importance: Unknown → Medium
Changed in rhythmbox:
status: New → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.