Commit 4b90bd85 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Solved sync issues

parent 92f2f1f5
......@@ -209,6 +209,7 @@ void ClipWorkflow::startRender( bool startInPausedMode )
void ClipWorkflow::clipEndReached()
{
qDebug() << "Clip workflow end reached";
setState( EndReached );
emit endReached( this );
}
......
......@@ -128,10 +128,7 @@ void MainWorkflow::getOutput()
continue ;
m_nbTracksToRender.fetchAndAddAcquire( 1 );
if ( m_tracks[i]->getOutput( m_currentFrame ) != false )
{
break ;
}
m_tracks[i]->getOutput( m_currentFrame );
}
if ( m_paused == false )
nextFrame();
......@@ -289,6 +286,7 @@ Clip* MainWorkflow::removeClip( const QUuid& uuid, unsigned int trackId )
Q_ASSERT( trackId < m_trackCount );
Clip* clip = m_tracks[trackId]->removeClip( uuid );
activateTrack( trackId );
emit clipRemoved( uuid, trackId );
return clip;
}
......@@ -319,10 +317,12 @@ void MainWorkflow::tracksRenderCompleted( unsigned int trackId )
{
QMutexLocker lock( m_highestTrackNumberMutex );
if ( m_highestTrackNumber <= trackId )
unsigned char* buff = m_tracks[trackId]->getSynchroneOutput();
if ( m_highestTrackNumber <= trackId && buff != NULL )
{
m_highestTrackNumber = trackId;
m_synchroneRenderingBuffer = m_tracks[trackId]->getSynchroneOutput();
m_synchroneRenderingBuffer = buff;;
}
}
//We check for minus or equal, since we can have 0 frame to compute,
......@@ -376,4 +376,6 @@ void MainWorkflow::activateTrack( unsigned int trackId )
{
if ( m_tracks[trackId]->getLength() > 0 )
m_tracks[trackId].activate();
else
m_tracks[trackId].deactivate();
}
......@@ -63,7 +63,7 @@ void TrackWorkflow::addClip( ClipWorkflow* cw, qint64 start )
connect( cw, SIGNAL( renderComplete( ClipWorkflow* ) ), this, SLOT( clipWorkflowRenderCompleted( ClipWorkflow* ) ), Qt::DirectConnection );
connect( cw, SIGNAL( paused() ), this, SLOT( clipWorkflowPaused() ) );
connect( cw, SIGNAL( unpaused() ), this, SLOT( clipWorkflowUnpaused() ) );
connect( cw, SIGNAL( endReached( ClipWorkflow* ) ), this, SLOT( clipWorkflowEndReached( ClipWorkflow* ) ) );
connect( cw, SIGNAL( endReached( ClipWorkflow* ) ), this, SLOT( clipWorkflowEndReached( ClipWorkflow* ) ), Qt::QueuedConnection );
m_clips.insert( start, cw );
computeLength();
}
......@@ -283,6 +283,11 @@ bool TrackWorkflow::getOutput( qint64 currentFrame )
qint64 start = it.key();
ClipWorkflow* cw = it.value();
//Is the clip supposed to render now ?
if ( needRepositioning == true && it.value().activated() == false )
{
qDebug() << "Reactivating clipworkflow";
it.value().activate();
}
if ( start <= currentFrame && currentFrame <= start + cw->getClip()->getLength() )
{
if ( it.value().activated() == false )
......@@ -484,10 +489,13 @@ void TrackWorkflow::clipWorkflowEndReached( ClipWorkflow* cw )
}
Q_ASSERT( it != end );
qDebug() << "Deactivating clip";
clipWorkflowRenderCompleted( cw );
stopClipWorkflow( it.value() );
qDebug() << "Stopped clip workflow";
it.value().deactivate();
//If this clip is the last, we emit the trackEndReached signal, and stop the
//clip workflow.
cw->stop();
//this obviously couldn't happen, since we have a clipworkflow...
Q_ASSERT( m_clips.size() != 0 );
......@@ -496,7 +504,5 @@ void TrackWorkflow::clipWorkflowEndReached( ClipWorkflow* cw )
if ( last.value() == cw )
emit trackEndReached( m_trackId );
//Else: simulating that the clip render is complete, because the TrackWorkflow
//waits for this clip to render.
else
clipWorkflowRenderCompleted( cw );
//waits for this clip to render.
}
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