Commit 46228b4d authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Corrected inconsistance (push_back // head)

parent 25734f97
......@@ -153,7 +153,7 @@ int WorkflowRenderer::lockAudio( WorkflowRenderer* self, int64_t *pts, size
*buffer = self->m_renderAudioSample->buff;
*bufferSize = self->m_renderAudioSample->size;
ptsDiff = self->m_renderAudioSample->ptsDiff;
qWarning() << "injecting audio sample";
qWarning() << "injecting audio sample from sample #" << self->m_renderAudioSample->debugId;
}
else
{
......
......@@ -78,6 +78,11 @@ public:
QMutexLocker lock( m_mutex );
m_pool.push_back( val );
}
void push_front( const T& val )
{
QMutexLocker lock( m_mutex );
m_pool.push_front( val );
}
private:
QQueue<T> m_pool;
......
......@@ -100,6 +100,7 @@ void AudioClipWorkflow::lock( AudioClipWorkflow* cw, uint8_t** pcm_buffer
for ( unsigned int i = 0; i < AudioClipWorkflow::nbBuffers; ++i )
{
AudioSample* as = cw->createBuffer( size );
as->debugId = i;
cw->m_availableBuffers.push_back( as );
}
}
......@@ -112,7 +113,7 @@ void AudioClipWorkflow::lock( AudioClipWorkflow* cw, uint8_t** pcm_buffer
}
else
as = cw->m_availableBuffers.pop();
cw->m_computedBuffers.push_back( as );
cw->m_computedBuffers.push_front( as );
*pcm_buffer = as->buff;
}
......@@ -130,12 +131,15 @@ void AudioClipWorkflow::unlock( AudioClipWorkflow* cw, uint8_t* pcm_buffe
cw->computePtsDiff( pts );
AudioSample* as = cw->m_computedBuffers.head();
qWarning() << "Computing audio PTS: pts:" << pts << "m_currentPts:" << cw->m_currentPts << "m_previousPts:" << cw->m_previousPts << "for buffer#" << as->debugId;
if ( as->buff != NULL )
{
as->nbSample = nb_samples;
as->nbChannels = channels;
as->ptsDiff = cw->m_currentPts - cw->m_previousPts;
}
else
qCritical() << "Got NULL audio buffer";
cw->commonUnlock();
cw->m_renderLock->unlock();
}
......
......@@ -36,6 +36,7 @@ class AudioClipWorkflow : public ClipWorkflow
unsigned int nbSample;
unsigned int nbChannels;
qint64 ptsDiff;
uint32_t debugId;
};
AudioClipWorkflow( Clip* clip );
~AudioClipWorkflow();
......
......@@ -116,7 +116,7 @@ void VideoClipWorkflow::lock( VideoClipWorkflow* cw, void** pp_ret, int size
}
else
lvf = cw->m_availableBuffers.pop();
cw->m_computedBuffers.push_back( lvf );
cw->m_computedBuffers.push_front( lvf );
// qWarning() << ">>>VideoGeneration. Available:" << cw->m_availableBuffers.count() << "Computed:" << cw->m_computedBuffers.count();
// qWarning() << "feeding video buffer";
*pp_ret = (*(lvf))->frame.octets;
......
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