Commit 72a5bf84 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Solved dead lock when all the tracks are empty

parent 116529cc
......@@ -46,7 +46,7 @@ MainWorkflow::MainWorkflow( int trackCount ) :
m_tracks[i].setPtr( new TrackWorkflow( i ) );
connect( m_tracks[i], SIGNAL( trackEndReached( unsigned int ) ), this, SLOT( trackEndReached(unsigned int) ) );
connect( m_tracks[i], SIGNAL( trackPaused() ), this, SLOT( trackPaused() ) );
connect( m_tracks[i], SIGNAL( renderCompleted( unsigned int ) ), this, SLOT( tracksRenderCompleted( unsigned int ) ), Qt::DirectConnection );
connect( m_tracks[i], SIGNAL( renderCompleted( unsigned int ) ), this, SLOT( tracksRenderCompleted( unsigned int ) ), Qt::QueuedConnection );
}
m_renderStartedLock = new QReadWriteLock;
m_renderMutex = new QMutex;
......@@ -134,10 +134,14 @@ unsigned char* MainWorkflow::getOutput()
if ( ret == NULL )
ret = MainWorkflow::blackOutput;
nextFrame();
qDebug() << "Getoutput complete";
return ret;
}
else
{
qDebug() << "Getoutput empty";
return MainWorkflow::blackOutput;
}
}
void MainWorkflow::pause()
......
......@@ -329,6 +329,15 @@ unsigned char* TrackWorkflow::getOutput( qint64 currentFrame )
{
m_oneFrameOnly = 0;
}
if ( ret == NULL )
{
qDebug() << "No output";
clipWorkflowRenderCompleted( NULL );
}
else
{
qDebug() << "Got output";
}
return ret;
}
......@@ -476,13 +485,23 @@ void TrackWorkflow::clipWorkflowPaused()
void TrackWorkflow::clipWorkflowRenderCompleted( ClipWorkflow* cw )
{
m_synchroneRenderBuffer = cw->getOutput();
if ( cw != NULL )
m_synchroneRenderBuffer = cw->getOutput();
else
m_synchroneRenderBuffer = NULL;
m_nbClipToRender.fetchAndAddAcquire( -1 );
if ( m_nbClipToRender == 0 )
//When there is nothing to render, m_nbClipToRender will be equal to one here, so we check for minus
//or equal to 0
if ( m_nbClipToRender <= 0 )
{
qDebug() << "TrackWorkflow render is completed. Buffer =" << (void*)m_synchroneRenderBuffer;
emit renderCompleted( m_trackId );
}
else
{
qDebug() << "Trackworfklow render isn't complete yet." << m_nbClipToRender << "cw remaining";
}
qDebug() << "End of method";
}
unsigned char* TrackWorkflow::getSynchroneOutput()
......
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