Dragan and Ivan, On Sat, 12 Jun 2010, Dragan Noveski wrote:
If you minimize stretchplayer, does this go down to nearly zero? Looks like the GUI is over-active. Maybe this is a part of the problem.you may be right, cause also the x is eating like 10 times more cpu once the stretchplayer is started.
This isn't a fix... but perhaps a "proof-of-fix." The attached patch will throttle the GUI. Can you guys try it out and see if things improve?
Thanks, Gabriel
diff --git a/src/PlayerWidget.cpp b/src/PlayerWidget.cpp index d2cb53e..85298b0 100644 --- a/src/PlayerWidget.cpp +++ b/src/PlayerWidget.cpp @@ -38,6 +38,10 @@ #include <QCoreApplication> #include <cmath> +#include <iostream> +#include <time.h> +#include <unistd.h> +using namespace std; namespace StretchPlayer { @@ -67,12 +71,13 @@ namespace StretchPlayer | Qt::FramelessWindowHint ); -#if QT_VERSION >= 0x040500 - setAttribute( Qt::WA_TranslucentBackground ); - _compositing = true; -#else +// #if QT_VERSION >= 0x040500 +// setAttribute( Qt::WA_TranslucentBackground ); +// _compositing = true; +// #else +// _compositing = false; +// #endif _compositing = false; -#endif setMinimumSize(_sizes.preferred_width()*2/3, _sizes.preferred_height()*2/3); QSizePolicy policy(QSizePolicy::Fixed, QSizePolicy::Fixed); @@ -281,6 +286,22 @@ namespace StretchPlayer void PlayerWidget::paintEvent(QPaintEvent * event) { + static time_t clock = time(0), now; + static uint32_t counter = 0; + + now = time(0); + if( now > clock ) { + clock = now; + } else { + usleep(50000); + return; + } + +// if( (now - clock) >= 10 ) { +// cout << "Update rate = " << (float(counter)/(float(now-clock))) << endl; +// clock = now; +// counter = 0; +// } QPainter painter(this); painter.setRenderHints(QPainter::Antialiasing); @@ -657,7 +678,7 @@ namespace StretchPlayer QTimer* timer = new QTimer(this); timer->setSingleShot(false); - timer->setInterval(200); + timer->setInterval(1000); connect(timer, SIGNAL(timeout()), this, SLOT(update_time())); timer->start();
_______________________________________________ Linux-audio-user mailing list Linux-audio-user@xxxxxxxxxxxxxxxxxxxx http://lists.linuxaudio.org/listinfo/linux-audio-user