Commit 9569337e authored by Vincent Carrubba's avatar Vincent Carrubba

Resolving some crash when there is no input to the EffectsEngine

parent 02b8d3cc
......@@ -87,25 +87,16 @@ void MixerEffect::render( void )
QHash< QString, InSlot<LightVideoFrame> >::iterator it = m_videoInputs.begin();
QHash< QString, InSlot<LightVideoFrame> >::iterator end = m_videoInputs.end();
qDebug() << "MixerEffect";
while ( it != end )
{
const VideoFrame& lvf = static_cast<VideoFrame>( static_cast<LightVideoFrame>( ( it.value() ) ) );
if ( lvf.rvf.raw != NULL )
{
// qDebug() << "PONEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEY";
// for ( i = 0; i < lvf.nboctets; ++i )
// {
// qDebug() << "DUMP MIXER"
// << "lvf.rvf.raw[" << i << "] = "
// << lvf.rvf.raw[i];
// }
m_videoOutputs["out"] << it.value();
m_videoOutputs["out"] << lvf;
return ;
}
++it;
}
qDebug() << "Endof MixerEffect";
return ;
}
......@@ -17,42 +17,19 @@ PouetEffect::~PouetEffect()
void PouetEffect::render( void )
{
qDebug() << "---------->PouetEffect";
static qint32 nbp = -1;
quint32 i;
LightVideoFrame tmp;
quint32 size;
// m_videoOutputs["out"] << m_videoInputs["in"];
( m_videoInputs["in"] ) >> tmp;
// for ( i = 0; i < tmp.nboctets; ++i )
// {
// qDebug() << "DUMP"
// << "tmp.rvf.raw[" << i << "] = "
// << tmp.rvf.raw[i];
// }
for ( i = 0; i < tmp.nbpixels; ++i )
( m_videoInputs["in"] ) >> tmp;
if (tmp.rvf.raw != NULL)
{
// qDebug() << "BEFORE MODIFIYING COLORS"
// << "tmp.rvf.pixel[i].Red = "
// << tmp.rvf.pixel[i].Red
// << '\n'
// << "tmp.rvf.pixel[i].Blue = "
// << tmp.rvf.pixel[i].Blue
// << "\n-----------------------";
tmp.rvf.pixel[i].Red = 0;
tmp.rvf.pixel[i].Blue = 0;
// qDebug() << "AFTER MODIFIYING COLORS"
// << "tmp.rvf.pixel[i].Red = "
// << tmp.rvf.pixel[i].Red
// << '\n'
// << "tmp.rvf.pixel[i].Blue = "
// << tmp.rvf.pixel[i].Blue
// << "\n-----------------------";
for ( i = 0; i < tmp.nbpixels; ++i )
{
tmp.rvf.pixel[i].Red = 0;
tmp.rvf.pixel[i].Blue = 0;
}
(m_videoOutputs["out"]) << tmp;
}
(m_videoOutputs["out"]) << tmp;
qDebug() << "End of PouetEffect";
return ;
}
......@@ -25,6 +25,7 @@
#include "MainWorkflow.h"
VideoFrame* MainWorkflow::nullOutput = NULL;
VideoFrame* MainWorkflow::blackOutput = NULL;
MainWorkflow* MainWorkflow::m_instance = NULL;
......@@ -38,7 +39,9 @@ MainWorkflow::MainWorkflow( int trackCount ) :
"MainWorkflow constructor", "Can't have more than one MainWorkflow instance" );
m_instance = this;
MainWorkflow::blackOutput = new VideoFrame();
MainWorkflow::nullOutput = new VideoFrame();
MainWorkflow::blackOutput = new VideoFrame( VIDEOWIDTH * VIDEOHEIGHT * 3 );
memset(MainWorkflow::blackOutput->rvf.raw, 0, (VIDEOWIDTH * VIDEOHEIGHT * 3) );
m_tracks = new Toggleable<TrackWorkflow*>[trackCount];
for ( int i = 0; i < trackCount; ++i )
......@@ -71,6 +74,7 @@ MainWorkflow::~MainWorkflow()
for (unsigned int i = 0; i < m_trackCount; ++i)
delete m_tracks[i];
delete[] m_tracks;
delete nullOutput;
delete blackOutput;
}
......@@ -127,7 +131,7 @@ void MainWorkflow::getOutput()
{
if ( m_tracks[i].activated() == false )
{
m_effectEngine->setInputFrame( *MainWorkflow::blackOutput, i );
m_effectEngine->setInputFrame( *MainWorkflow::nullOutput, i );
continue ;
}
......@@ -328,7 +332,7 @@ void MainWorkflow::tracksRenderCompleted( unsigned int trackId )
{
VideoFrame* buff = m_tracks[trackId]->getSynchroneOutput();
if ( buff == NULL )
m_effectEngine->setInputFrame( *MainWorkflow::blackOutput, trackId );
m_effectEngine->setInputFrame( *MainWorkflow::nullOutput, trackId );
else
m_effectEngine->setInputFrame( *buff, trackId );
}
......@@ -356,8 +360,10 @@ const VideoFrame* MainWorkflow::getSynchroneOutput()
m_effectEngine->render();
m_synchroneRenderingBuffer = &( m_effectEngine->getOutputFrame( 0 ) );
m_synchroneRenderWaitConditionMutex->unlock();
if ( m_synchroneRenderingBuffer == NULL )
if ( m_synchroneRenderingBuffer->rvf.raw == NULL )
return MainWorkflow::blackOutput;
return m_synchroneRenderingBuffer;
}
......
......@@ -82,6 +82,7 @@ class MainWorkflow : public QObject, public Singleton<MainWorkflow>
void pause();
void unpause();
static VideoFrame* nullOutput;
static VideoFrame* blackOutput;
void nextFrame();
void previousFrame();
......
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