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

This should solve set time problem, but it doesn't. To be continued.

parent d8f28697
......@@ -59,7 +59,9 @@ void* AudioClipWorkflow::getOutput( ClipWorkflow::GetMode mode )
{
QMutexLocker lock( m_renderLock );
QMutexLocker lock2( m_computedBuffersMutex );
preGetOutput();
if ( preGetOutput() == false )
return NULL;
// qWarning() << "Audio. Available:" << m_availableBuffers.count() << "Computed:" << m_computedBuffers.count();
if ( isEndReached() == true )
......@@ -146,7 +148,7 @@ void AudioClipWorkflow::unlock( AudioClipWorkflow* cw, uint8_t* pcm_buffe
as->nbChannels = channels;
as->ptsDiff = cw->m_currentPts - cw->m_previousPts;
}
// qWarning() << "::::Computing audio PTS: debugId:" << as->debugId << "ptsdiff:" << as->ptsDiff;
qWarning() << "::::Computing audio PTS: debugId:" << as->debugId << "ptsdiff:" << as->ptsDiff;
cw->commonUnlock();
cw->m_renderLock->unlock();
cw->m_computedBuffersMutex->unlock();
......
......@@ -179,7 +179,7 @@ LibVLCpp::MediaPlayer* ClipWorkflow::getMediaPlayer()
return m_mediaPlayer;
}
void ClipWorkflow::preGetOutput()
bool ClipWorkflow::preGetOutput()
{
QMutexLocker lock( m_feedingCondWait->getMutex() );
......@@ -187,13 +187,9 @@ void ClipWorkflow::preGetOutput()
if ( getNbComputedBuffers() == 0 )
{
// qWarning() << "Waiting for buffer to be fed";
m_renderLock->unlock();
m_computedBuffersMutex->unlock();
qDebug() << "Unlocked render lock, entering cond wait";
m_feedingCondWait->waitLocked();
m_computedBuffersMutex->lock();
m_renderLock->lock();
return false;
}
return true;
}
void ClipWorkflow::postGetOutput()
......@@ -209,8 +205,8 @@ void ClipWorkflow::postGetOutput()
// This will act like an "unpause";
m_mediaPlayer->pause();
}
else if ( debugType == 1)
qCritical() << "Running out of computed buffers !";
else
qCritical() << "Running out of computed buffers ! debugType:" << debugType;
}
}
......@@ -274,7 +270,7 @@ void ClipWorkflow::mediaPlayerPaused()
void ClipWorkflow::mediaPlayerUnpaused()
{
qWarning() << "Media player unpaused. Go back to rendering. Type:" << debugType;
// qWarning() << "Media player unpaused. Go back to rendering. Type:" << debugType;
setState( ClipWorkflow::Rendering );
m_pauseDuration = mdate() - m_beginPausePts;
// qDebug() << "pause duration:" << m_pauseDuration;
......
......@@ -84,7 +84,7 @@ class ClipWorkflow : public QObject
* of the rendering process advancement.
*/
virtual void* getOutput( ClipWorkflow::GetMode mode ) = 0;
void preGetOutput();
bool preGetOutput();
void postGetOutput();
virtual void initVlcOutput() = 0;
void initialize();
......
......@@ -115,22 +115,27 @@ TrackHandler::getOutput( qint64 currentFrame )
m_effectEngine->setVideoInput( i + 1, *TrackHandler::nullOutput );
else
{
StackedBuffer<LightVideoFrame*>* stackedBuffer =
reinterpret_cast<StackedBuffer<LightVideoFrame*>*>(
m_tracks[i]->getOutput( currentFrame ) );
m_effectEngine->setVideoInput( i + 1, *( stackedBuffer->get() ) );
void* ret = m_tracks[i]->getOutput( currentFrame );
if ( ret == NULL )
m_effectEngine->setVideoInput( i + 1, *TrackHandler::nullOutput );
else
{
StackedBuffer<LightVideoFrame*>* stackedBuffer =
reinterpret_cast<StackedBuffer<LightVideoFrame*>*>( ret );
m_effectEngine->setVideoInput( i + 1, *( stackedBuffer->get() ) );
}
}
}
else
{
StackedBuffer<AudioClipWorkflow::AudioSample*>*
stackedBuffer =
reinterpret_cast<StackedBuffer<AudioClipWorkflow::AudioSample*>*> (
m_tracks[i]->getOutput( currentFrame ) );
void* ret = m_tracks[i]->getOutput( currentFrame );
//m_tmpAudioBuffer is NULl by default, so it will remain NULL if we continue;
if ( ret == NULL )
continue ;
StackedBuffer<AudioClipWorkflow::AudioSample*>* stackedBuffer =
reinterpret_cast<StackedBuffer<AudioClipWorkflow::AudioSample*>*> ( ret );
if ( stackedBuffer != NULL )
m_tmpAudioBuffer = stackedBuffer->get();
//else if will remain NULL
}
}
}
......
......@@ -92,9 +92,10 @@ VideoClipWorkflow::getOutput( ClipWorkflow::GetMode mode )
QMutexLocker lock( m_renderLock );
QMutexLocker lock2( m_computedBuffersMutex );
preGetOutput();
qWarning() << "Video::getOutput(). Available:" << m_availableBuffers.count() <<
"Computed:" << m_computedBuffers.count();
if ( preGetOutput() == false )
return NULL;
// qWarning() << "Video::getOutput(). Available:" << m_availableBuffers.count() <<
// "Computed:" << m_computedBuffers.count();
if ( isEndReached() == true )
return NULL;
::StackedBuffer<LightVideoFrame*>* buff;
......
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