Package: kmix Version: 4:4.14.0-1 Severity: normal Tags: patch When PULSE_SERVER is set to connect to a remote location and the remote is currently unavailable, kmix tries to reconnect up to 20 times per second. This results in a significant cpu load. The bug has already been reported upstream as KDE bug #339913 (https://bugs.kde.org/show_bug.cgi?id=339913). Based on the comments in the upstream bugreport I made this (crude) patch below, which works for me.
Sammy Index: kmix-4.14.0/backends/mixer_pulse.cpp =================================================================== --- kmix-4.14.0.orig/backends/mixer_pulse.cpp +++ kmix-4.14.0/backends/mixer_pulse.cpp @@ -37,6 +37,8 @@ # include <canberra.h> #endif +#include <time.h> + // PA_VOLUME_UI_MAX landed in pulseaudio-0.9.23, so this can be removed when/if // minimum requirement is ever bumped up (from 0.9.12 currently) #ifndef PA_VOLUME_UI_MAX @@ -716,7 +718,14 @@ static void context_state_callback(pa_co if (s_mixers.contains(KMIXPA_PLAYBACK)) { kWarning(67100) << "Connection to PulseAudio daemon closed. Attempting reconnection."; s_pulseActive = UNKNOWN; - QTimer::singleShot(50, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit())); + static time_t last_timestamp = 0; + time_t current_time = time(NULL); + if ((current_time - last_timestamp) > 3) { + QTimer::singleShot(50, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit())); + } else { + QTimer::singleShot(60000, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit())); + } + last_timestamp = current_time; } } } Disclaimer: http://transtrend.com/disclaimer.txt
Index: kmix-4.14.0/backends/mixer_pulse.cpp =================================================================== --- kmix-4.14.0.orig/backends/mixer_pulse.cpp +++ kmix-4.14.0/backends/mixer_pulse.cpp @@ -37,6 +37,8 @@ # include <canberra.h> #endif +#include <time.h> + // PA_VOLUME_UI_MAX landed in pulseaudio-0.9.23, so this can be removed when/if // minimum requirement is ever bumped up (from 0.9.12 currently) #ifndef PA_VOLUME_UI_MAX @@ -716,7 +718,14 @@ static void context_state_callback(pa_co if (s_mixers.contains(KMIXPA_PLAYBACK)) { kWarning(67100) << "Connection to PulseAudio daemon closed. Attempting reconnection."; s_pulseActive = UNKNOWN; - QTimer::singleShot(50, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit())); + static time_t last_timestamp = 0; + time_t current_time = time(NULL); + if ((current_time - last_timestamp) > 3) { + QTimer::singleShot(50, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit())); + } else { + QTimer::singleShot(60000, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit())); + } + last_timestamp = current_time; } } }