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

Solved multiple bugs.

Solved dead lock
Solved multiple clipworkflow creation
Deactivated message handlers and audiospectrum computing.
parent 79d541b3
......@@ -51,7 +51,11 @@ void MetaDataWorker::compute()
if ( m_media->getFileType() == Media::Video )
{
if ( m_type == Audio )
computeAudioMetaData();
{
qDebug() << "Skipping metadata computing";
return ;
// computeAudioMetaData();
}
else
computeVideoMetaData();
}
......
......@@ -146,7 +146,7 @@ int WorkflowRenderer::lockVideo( int64_t *pts, size_t *bufferSize, void **bu
ptsDiff = 1000000 / m_outputFps;
}
m_pts = *pts = ptsDiff + m_pts;
qDebug() << "Video pts" << m_pts << "diff" << ptsDiff;
// qDebug() << "Video pts" << m_pts << "diff" << ptsDiff;
//*pts = qRound64( (float)( m_pts * 1000000.0f ) / m_outputFps );
//++m_pts;
*buffer = m_renderVideoFrame;
......@@ -160,7 +160,9 @@ int WorkflowRenderer::lockAudio( int64_t *pts, size_t *bufferSize, void **b
if ( m_stopping == false )
{
qDebug() << "getting MainWorkflow audio output";
MainWorkflow::OutputBuffers* ret = m_mainWorkflow->getOutput( MainWorkflow::AudioTrack );
qDebug() << "got mainworkflow audio output";
m_renderAudioSample = ret->audio;
}
uint32_t nbSample;
......
......@@ -71,7 +71,7 @@ VlmcDebug::~VlmcDebug()
void VlmcDebug::setup()
{
qInstallMsgHandler( VlmcDebug::vlmcMessageHandler );
// qInstallMsgHandler( VlmcDebug::vlmcMessageHandler );
}
void VlmcDebug::logFileChanged( const QVariant& logFileV )
......
......@@ -57,30 +57,31 @@ void* AudioClipWorkflow::getUnlockCallback()
void* AudioClipWorkflow::getOutput( ClipWorkflow::GetMode mode )
{
// qDebug() << "entering audio get output";
qDebug() << "entering audio get output";
QMutexLocker lock( m_renderLock );
// qDebug() << "got audio render lock";
qDebug() << "got audio render lock";
QMutexLocker lock2( m_computedBuffersMutex );
qDebug() << "got computed buffers mutex";
if ( preGetOutput() == false )
{
// qDebug() << "audio preGetOutput() returned false";
qDebug() << "audio preGetOutput() returned false";
return NULL;
}
// qWarning() << "Audio. Available:" << m_availableBuffers.count() << "Computed:" << m_computedBuffers.count();
qWarning() << "Audio. Available:" << m_availableBuffers.count() << "Computed:" << m_computedBuffers.count();
if ( isEndReached() == true )
{
// qDebug() << "audio end is reached";
qDebug() << "audio end is reached";
return NULL;
}
if ( mode == ClipWorkflow::Get )
qCritical() << "A sound buffer should never be asked with 'Get' mode";
::StackedBuffer<AudioSample*>* buff = new StackedBuffer(
m_computedBuffers.dequeue(), this, true );
// qDebug() << "calling audio postGetOutput();";
qDebug() << "calling audio postGetOutput();";
postGetOutput();
// qDebug() << "returning audio buffer";
qDebug() << "returning audio buffer";
return buff;
}
......@@ -112,8 +113,8 @@ AudioClipWorkflow::AudioSample* AudioClipWorkflow::createBuffer( size_t size
void AudioClipWorkflow::lock( AudioClipWorkflow* cw, uint8_t** pcm_buffer , unsigned int size )
{
QMutexLocker lock( cw->m_availableBuffersMutex );
cw->m_computedBuffersMutex->lock();
cw->m_renderLock->lock();
cw->m_computedBuffersMutex->lock();
// qWarning() << ">>>AudioGeneration. Available:" << cw->m_availableBuffers.count() << "Computed:" << cw->m_computedBuffers.count();
AudioSample* as = NULL;
......
......@@ -74,7 +74,7 @@ class AudioClipWorkflow : public ClipWorkflow
unsigned int size, qint64 pts );
//FIXME: this is totally random powered ! Please adjust with a value that does make sense...
static const uint32_t nbBuffers = 128;
static const uint32_t nbBuffers = 256;
};
#endif // AUDIOCLIPWORKFLOW_H
......@@ -56,6 +56,7 @@ ClipWorkflow::~ClipWorkflow()
void ClipWorkflow::initialize()
{
setState( ClipWorkflow::Initializing );
if ( m_clip->getParent()->getFileType() == Media::Image )
m_vlcMedia = new LibVLCpp::Media( "fake:///" + m_clip->getParent()->getFileInfo()->absoluteFilePath() );
else
......
......@@ -45,23 +45,28 @@ class ClipWorkflow : public QObject
None = -1,
/// \brief Used when the clipworkflow hasn't been started yet
Stopped, //0
/**
* \brief Used when initializing is in progress (until the mediaplayer
* enters the playing state.
*/
Initializing, //1
/// \brief Used when the clipworkflow is launched and active
Rendering, //1
Rendering, //2
/// \brief Used when stopping
Stopping, //2
Stopping, //3
/// \brief Used when end is reached, IE no more frame has to be rendered, but the trackworkflow
/// may eventually ask for some.
EndReached, //3
EndReached, //4
// Here starts internal states :
/// \brief This state will be used when an unpause
/// has been required
UnpauseRequired, //4
UnpauseRequired, //5
/// \brief This state will be used when a pause
/// has been required
PauseRequired, //5
PauseRequired, //6
/// \brief This state will be used when the media player is paused,
/// because of a sufficient number of computed buffers
Paused, //6
Paused, //7
};
/**
......
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