Skip to content
Permalink
Browse files

fixup! mmalrenderer: Execute callbacks from main thread

  • Loading branch information...
popcornmix committed Jun 29, 2016
1 parent 49592c2 commit bc482f4124cadaad8a8ccd05914bf5e9f3278086
Showing with 30 additions and 13 deletions.
  1. +30 −13 xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/MMALRenderer.cpp
@@ -296,10 +296,13 @@ void CMMALRenderer::Process()
// this is case where we would like to display a new frame
if (m_error > 0.0)
{
MMAL_STATUS_T status = MMAL_SUCCESS;
m_error -= 1.0;
MMAL_BUFFER_HEADER_T *buffer = mmal_queue_get(m_queue_render);
if (buffer)
mmal_port_send_buffer(m_vout_input, buffer);
status = mmal_port_send_buffer(m_vout_input, buffer);
if (status != MMAL_SUCCESS)
CLog::Log(LOGERROR, "%s::%s - Failed send buffer to vout input port (status=0%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status));
if (g_advancedSettings.CanLogComponent(LOGVIDEO))
CLog::Log(LOGDEBUG, "%s::%s - buffer:%p vsync:%d queue:%d diff:%f", CLASSNAME, __func__, buffer, g_RBP.LastVsync(), mmal_queue_length(m_queue_render), m_error);
}
@@ -315,20 +318,31 @@ void CMMALRenderer::Run()
assert(buffer);
if (buffer == &m_quitpacket)
break;
if (1)
CSingleLock lock(m_sharedSection);
bool kept = false;

CMMALBuffer *omvb = (CMMALBuffer *)buffer->user_data;
if (VERBOSE && g_advancedSettings.CanLogComponent(LOGVIDEO))
CLog::Log(LOGDEBUG, "%s::%s omvb:%p mmal:%p dts:%.3f pts:%.3f len:%d cmd:%x flags:%x flight:%d", CLASSNAME, __func__,
omvb, buffer, buffer->dts*1e-6, buffer->pts*1e-6, buffer->length, buffer->cmd, buffer->flags, m_inflight);

assert(!omvb || buffer == omvb->mmal_buffer);
assert(buffer->cmd == 0);
assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_EOS));
assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED));
if (omvb) // deint_in
{
assert(!(buffer->flags & MMAL_BUFFER_HEADER_FLAG_TRANSMISSION_FAILED));
buffer->flags &= ~MMAL_BUFFER_HEADER_FLAG_USER2;
CMMALBuffer *omvb = (CMMALBuffer *)buffer->user_data;
if (VERBOSE && g_advancedSettings.CanLogComponent(LOGVIDEO))
CLog::Log(LOGDEBUG, "%s::%s omvb:%p mmal:%p:%p len:%d cmd:%x flags:%x flight:%d", CLASSNAME, __func__, omvb, buffer, omvb->mmal_buffer, buffer->length, buffer->cmd, buffer->flags, m_inflight);
assert(buffer == omvb->mmal_buffer);
assert(buffer->length == 0);
m_inflight--;
omvb->Release();
kept = true;
}
if (!kept)
{
mmal_buffer_header_reset(buffer);
buffer->cmd = 0;
mmal_buffer_header_release(buffer);
}

if (g_advancedSettings.CanLogComponent(LOGVIDEO))
CLog::Log(LOGDEBUG, "%s::%s Got buffer:%p len:%d", CLASSNAME, __func__, buffer, mmal_queue_length(m_queue_process));
}
}

@@ -507,6 +521,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha)

if (omvb && omvb->mmal_buffer)
{
MMAL_STATUS_T status = MMAL_SUCCESS;
if (g_advancedSettings.CanLogComponent(LOGVIDEO))
CLog::Log(LOGDEBUG, "%s::%s - MMAL: clear:%d flags:%x alpha:%d source:%d omvb:%p mmal:%p mflags:%x pts:%.3f", CLASSNAME, __func__, clear, flags, alpha, source, omvb, omvb->mmal_buffer, omvb->mmal_buffer->flags, m_pts[source]*1e-6);
// check for changes in aligned sizes
@@ -520,7 +535,7 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha)
m_vout_input->format->es->video.height = omvb->m_aligned_height;
m_vout_input->format->es->video.crop.width = omvb->m_width;
m_vout_input->format->es->video.crop.height = omvb->m_height;
MMAL_STATUS_T status = mmal_port_format_commit(m_vout_input);
status = mmal_port_format_commit(m_vout_input);
if (status != MMAL_SUCCESS)
{
CLog::Log(LOGERROR, "%s::%s Failed to commit vout input format (status=%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status));
@@ -535,7 +550,9 @@ void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha)
if (m_queue_render)
mmal_queue_put(m_queue_render, omvb->mmal_buffer);
else
mmal_port_send_buffer(m_vout_input, omvb->mmal_buffer);
status = mmal_port_send_buffer(m_vout_input, omvb->mmal_buffer);
if (status != MMAL_SUCCESS)
CLog::Log(LOGERROR, "%s::%s - Failed send buffer to vout input port (status=0%x %s)", CLASSNAME, __func__, status, mmal_status_to_string(status));
}
else
CLog::Log(LOGDEBUG, "%s::%s - MMAL: No buffer to update clear:%d flags:%x alpha:%d source:%d omvb:%p mmal:%p", CLASSNAME, __func__, clear, flags, alpha, source, omvb, omvb ? omvb->mmal_buffer : nullptr);

0 comments on commit bc482f4

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