[vlc-commits] Qt: rate limit EPG updates
Francois Cartegnie
git at videolan.org
Thu Dec 15 17:56:19 CET 2016
vlc/vlc-2.2 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 15 17:25:14 2016 +0100| [63a97e4d6eba8849debc0851e7c7a5699aebc336] | committer: Francois Cartegnie
Qt: rate limit EPG updates
As we don't have discrete updates due to use of input variable
for events, we're updating far too many times on EPG tables updates,
reprocessing the whole EPG set. This is mainly the performance
issue with large EPG updates.
Also no longer updates internal event storage when hidden.
backport of ba78a1fe00edbbb34502704347788f3455faccf4
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=63a97e4d6eba8849debc0851e7c7a5699aebc336
---
modules/gui/qt4/dialogs/epg.cpp | 29 +++++++++++++++++++++++------
modules/gui/qt4/dialogs/epg.hpp | 7 ++++++-
2 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/modules/gui/qt4/dialogs/epg.cpp b/modules/gui/qt4/dialogs/epg.cpp
index bf2c1fb..396ab3a 100644
--- a/modules/gui/qt4/dialogs/epg.cpp
+++ b/modules/gui/qt4/dialogs/epg.cpp
@@ -74,8 +74,8 @@ EpgDialog::EpgDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
layout->addWidget( descBox );
CONNECT( epg, itemSelectionChanged( EPGItem *), this, displayEvent( EPGItem *) );
- CONNECT( THEMIM->getIM(), epgChanged(), this, updateInfos() );
- CONNECT( THEMIM, inputChanged( ), this, updateInfos() );
+ CONNECT( THEMIM->getIM(), epgChanged(), this, scheduleUpdate() );
+ CONNECT( THEMIM, inputChanged( bool ), this, updateInfos() );
QDialogButtonBox *buttonsBox = new QDialogButtonBox( this );
@@ -92,8 +92,8 @@ EpgDialog::EpgDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
timer = new QTimer( this );
timer->setSingleShot( true );
- timer->setInterval( 1000 * 60 );
- CONNECT( timer, timeout(), this, updateInfos() );
+ timer->setInterval( 5000 );
+ CONNECT( timer, timeout(), this, timeout() );
updateInfos();
restoreWidgetPosition( "EPGDialog", QSize( 650, 450 ) );
@@ -104,6 +104,25 @@ EpgDialog::~EpgDialog()
saveWidgetPosition( "EPGDialog" );
}
+void EpgDialog::showEvent(QShowEvent *)
+{
+ scheduleUpdate();
+}
+
+void EpgDialog::timeout()
+{
+ if( !isVisible() )
+ scheduleUpdate();
+ else
+ updateInfos();
+}
+
+void EpgDialog::scheduleUpdate()
+{
+ if( !timer->isActive() )
+ timer->start( 5000 );
+}
+
void EpgDialog::displayEvent( EPGItem *epgItem )
{
if( !epgItem ) return;
@@ -122,7 +141,6 @@ void EpgDialog::displayEvent( EPGItem *epgItem )
void EpgDialog::updateInfos()
{
- timer->stop();
input_item_t *p_input_item = NULL;
playlist_t *p_playlist = THEPL;
input_thread_t *p_input_thread = playlist_CurrentInput( p_playlist ); /* w/hold */
@@ -137,7 +155,6 @@ void EpgDialog::updateInfos()
{
epg->updateEPG( p_input_item );
vlc_gc_decref( p_input_item );
- if ( isVisible() ) timer->start();
}
}
}
diff --git a/modules/gui/qt4/dialogs/epg.hpp b/modules/gui/qt4/dialogs/epg.hpp
index 88bbd26..10c3ff1 100644
--- a/modules/gui/qt4/dialogs/epg.hpp
+++ b/modules/gui/qt4/dialogs/epg.hpp
@@ -36,6 +36,9 @@ class EPGWidget;
class EpgDialog : public QVLCFrame, public Singleton<EpgDialog>
{
Q_OBJECT
+protected:
+ virtual void showEvent(QShowEvent * event) Q_DECL_OVERRIDE;
+
private:
EpgDialog( intf_thread_t * );
virtual ~EpgDialog();
@@ -48,8 +51,10 @@ private:
friend class Singleton<EpgDialog>;
private slots:
- void displayEvent( EPGItem * );
+ void scheduleUpdate();
void updateInfos();
+ void timeout();
+ void displayEvent( EPGItem * );
};
#endif
More information about the vlc-commits
mailing list