status: reduce wakeups with display_bitrate enabled

When system was profiled for wakeups, a high wakeup rate from mpd was observed even when paused. Strace-ing mpd pointed at excessive polling even though mpd_communication_mode is set to notifications. By method of elimination in the configuration, it was narrowed down to display_bitrate. By code inspection, it could be seen that Mpd.isPlaying() is true even if mpd is paused, but it doesn't make sense as to why bitrate needs to be constantly updated even when mpd is paused. Hence the patch.

Signed-off-by: Raghavendra D Prabhu <rprabhu@wnohang.net>
This commit is contained in:
Raghavendra D Prabhu
2012-12-08 23:24:47 +05:30
committed by Andrzej Rybczak
parent 419263b1b5
commit bbef713741

View File

@@ -80,7 +80,7 @@ void Status::trace()
{
past = Timer;
}
else if (Config.display_bitrate && Global::Timer.tv_sec > past.tv_sec && Mpd.isPlaying())
else if (Config.display_bitrate && Global::Timer.tv_sec > past.tv_sec && Mpd.GetState() == MPD::psPlay)
{
// ncmpcpp doesn't fetch status constantly if mpd supports
// idle mode so current song's bitrate is never updated.