Commit 9f0abbc3 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Resolved race condition when pausing render preview

parent b90b0164
......@@ -174,7 +174,7 @@ void MediaPlayer::takeSnapshot( const char* outputFil
CheckVlcppException( m_ex );
}
bool MediaPlayer::isPlaying()
bool MediaPlayer::isPlaying()
{
int res = libvlc_media_player_is_playing( m_internalPtr, m_ex );
CheckVlcppException( m_ex );
......
......@@ -93,7 +93,7 @@ void ClipWorkflow::lock( ClipWorkflow* cw, void** pp_ret )
// else
// {
*pp_ret = cw->m_buffer;
// qDebug() << "Clip workflow locking <<<<<<<<<<<<<<<<<<<<<<<<<<";
qDebug() << "Clip workflow locking <<<<<<<<<<<<<<<<<<<<<<<<<<";
// }
}
......@@ -114,8 +114,10 @@ void ClipWorkflow::unlock( ClipWorkflow* cw )
{
QMutexLocker lock( cw->m_condMutex );
qDebug() << "Setting state to Sleeping";
cw->m_state = Sleeping;
cw->m_stateLock->unlock();
//Signal that render has been completed.
cw->m_renderWaitCond->wake();
qDebug() << "Entering condwait";
......
......@@ -342,8 +342,9 @@ void TrackWorkflow::pauseClipWorkflow( ClipWorkflow* cw )
cw->getState() == ClipWorkflow::EndReached )
{
qDebug() << "Pausing a sleeping, ready or EndReached ClipWorkflow, state =" << cw->getState();
cw->getStateLock()->unlock();
cw->queryStateChange( ClipWorkflow::Pausing );
qDebug() << "Unlocked state mutex";
cw->getStateLock()->unlock();
cw->wake();
}
else if ( cw->getState() == ClipWorkflow::Rendering )
......
......@@ -85,6 +85,9 @@ void* WorkflowRenderer::lock( void* datas )
{
WorkflowRenderer* self = reinterpret_cast<WorkflowRenderer*>( datas );
//If we're not playing, then where in a paused media player.
if ( self->m_mediaPlayer->isPlaying() == false )
return self->m_lastFrame;
if ( self->m_oneFrameOnly < 2 )
{
qDebug() << "\nQuerying new picture";
......@@ -122,6 +125,7 @@ void WorkflowRenderer::checkActions()
switch ( act )
{
case Pause:
qDebug() << "Pausing WorkflowRenderer mediaPlayer";
m_mediaPlayer->pause();
//This will also pause the MainWorkflow via a signal/slot
break ;
......
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