Commit e254c50f authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

File rendering: Fixed synchronisation bug.

The buffer are now preload a bit before rendering.
parent a20a5f3f
......@@ -90,6 +90,8 @@ void WorkflowFileRenderer::run()
m_mainWorkflow->setFullSpeedRender( true );
m_mainWorkflow->startRender( width, height );
//Waiting for renderers to preload some frames:
sleep( 1 );
m_mediaPlayer->play();
}
......@@ -133,25 +135,25 @@ WorkflowFileRenderer::lock( void *datas, qint64 *dts, qint64 *pts, quint32 *flag
return ret;
}
void
void
WorkflowFileRenderer::unlock( void *datas, size_t size, void* buff )
{
WorkflowRenderer::unlock( datas, size, buff );
}
void
void
WorkflowFileRenderer::__frameChanged( qint64 frame, MainWorkflow::FrameChangedReason )
{
m_dialog->setProgressBarValue( frame * 100 / m_mainWorkflow->getLengthFrame() );
}
void*
void*
WorkflowFileRenderer::getLockCallback()
{
return (void*)&WorkflowFileRenderer::lock;
}
void*
void*
WorkflowFileRenderer::getUnlockCallback()
{
return (void*)&WorkflowFileRenderer::unlock;
......
......@@ -87,7 +87,10 @@ TrackHandler::startRender()
else
{
for ( unsigned int i = 0; i < m_trackCount; ++i )
{
activateTrack( i );
m_tracks[i]->preload();
}
}
}
......
......@@ -487,3 +487,20 @@ TrackWorkflow::unmuteClip( const QUuid &uuid )
qWarning() << "Failed to unmute clip" << uuid << "it probably doesn't exist "
"in this track";
}
void
TrackWorkflow::preload()
{
QReadLocker lock( m_clipsLock );
QMap<qint64, ClipWorkflow*>::iterator it = m_clips.begin();
QMap<qint64, ClipWorkflow*>::iterator end = m_clips.end();
while ( it != end )
{
qint64 start = it.key();
ClipWorkflow* cw = it.value();
if ( start < TrackWorkflow::nbFrameBeforePreload )
preloadClip( cw );
++it;
}
}
......@@ -87,6 +87,8 @@ class TrackWorkflow : public QObject
void muteClip( const QUuid& uuid );
void unmuteClip( const QUuid& uuid );
void preload();
private:
void computeLength();
void* renderClip( ClipWorkflow* cw, qint64 currentFrame,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment