Skip to content
Snippets Groups Projects
Commit cb4c1cc8 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

VLCSource: Remove sleep in thumbnail computation

parent 8862b217
No related branches found
No related tags found
No related merge requests found
......@@ -105,12 +105,21 @@ bool
VLCSource::computeSnapshot( VmemRenderer& renderer )
{
Q_ASSERT( m_snapshot == NULL );
renderer.start();
{
renderer.setTime( m_length / 3 );
//FIXME: This is bad and you should feel bad.
QThread::usleep( 500000 );
QMutex mutex;
QWaitCondition cond;
auto em = renderer.mediaPlayer().eventManager();
em.onPositionChanged([&mutex, &cond](float pos) {
QMutexLocker lock( &mutex );
if ( pos > 0.2 )
cond.wakeAll();
});
QMutexLocker lock( &mutex );
renderer.setPosition( 0.3 );
if ( cond.wait( &mutex, 2000 ) == false )
return false;
}
renderer.start();
m_snapshot = renderer.waitSnapshot();
return m_snapshot != NULL;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment