Skip to content
Permalink
Browse files

mmal: Move pool creation to open

  • Loading branch information...
popcornmix committed Jul 11, 2016
1 parent c87ad6d commit 1d48967b7aed4bbb85764284817386213e93e821
@@ -107,6 +107,7 @@ CMMALVideo::CMMALVideo(CProcessInfo &processInfo) : CDVDVideoCodec(processInfo)
m_dec_input = NULL;
m_dec_output = NULL;
m_dec_input_pool = NULL;
m_pool = nullptr;

m_deint = NULL;
m_deint_connection = NULL;
@@ -768,6 +769,9 @@ bool CMMALVideo::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options)
return false;
}

m_pool = std::make_shared<CMMALPool>(m_dec_output, m_dec_output->buffer_num, m_dec_output->buffer_size);
assert(m_pool);

if (!SendCodecConfigData())
return false;

@@ -937,9 +941,6 @@ int CMMALVideo::Decode(uint8_t* pData, int iSize, double dts, double pts)
void CMMALVideo::Prime()
{
MMAL_BUFFER_HEADER_T *buffer;
// todo: Move to Open
if (!m_pool)
m_pool = std::make_shared<CMMALPool>(m_dec_output, m_dec_output->buffer_num, m_dec_output->buffer_size);
assert(m_pool);
MMAL_POOL_T *render_pool = m_pool->Get();
assert(render_pool);
@@ -218,6 +218,7 @@ CDecoder::CDecoder()
CLog::Log(LOGDEBUG, "%s::%s - create %p", CLASSNAME, __FUNCTION__, this);
m_shared = 0;
m_avctx = nullptr;
m_pool = nullptr;
}

CDecoder::~CDecoder()
@@ -349,6 +350,10 @@ bool CDecoder::Open(AVCodecContext *avctx, AVCodecContext* mainctx, enum AVPixel

m_avctx = mainctx;
m_fmt = fmt;

if (CreateDummyDecoder())
m_pool = std::make_shared<CMMALPool>(m_dec_output, m_dec_output->buffer_num, 0);
assert(m_pool);
return true;
}

@@ -418,11 +423,6 @@ bool CDecoder::GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture
frame->buf[1] != nullptr || frame->buf[0] == nullptr)
return false;

if (!m_pool)
{
if (CreateDummyDecoder())
m_pool = std::make_shared<CMMALPool>(m_dec_output, m_dec_output->buffer_num, 0);
}
assert(m_pool);
MMAL_POOL_T *render_pool = m_pool->Get();
assert(render_pool);

0 comments on commit 1d48967

Please sign in to comment.
You can’t perform that action at this time.