Skip to content

Commit

Permalink
[mmalrenderer] Render new from frame from RenderUpdate rather than Fl…
Browse files Browse the repository at this point in the history
…ipPage

FernetMenta confirmed this was the expected behaviour
  • Loading branch information
popcornmix committed Feb 15, 2015
1 parent 9f861b6 commit 487c6dc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
29 changes: 18 additions & 11 deletions xbmc/cores/VideoRenderers/MMALRenderer.cpp
Expand Up @@ -149,6 +149,7 @@ CMMALRenderer::CMMALRenderer()
m_vout_input_pool = NULL;
memset(m_buffers, 0, sizeof m_buffers);
m_release_queue = mmal_queue_create();
m_iYV12RenderBuffer = 0;
Create();
}

Expand Down Expand Up @@ -322,6 +323,7 @@ void CMMALRenderer::Reset()

void CMMALRenderer::Flush()
{
m_iYV12RenderBuffer = 0;
CLog::Log(LOGDEBUG, "%s::%s", CLASSNAME, __func__);
}

Expand All @@ -336,31 +338,23 @@ void CMMALRenderer::Update()

void CMMALRenderer::RenderUpdate(bool clear, DWORD flags, DWORD alpha)
{
int source = m_iYV12RenderBuffer;
#if defined(MMAL_DEBUG_VERBOSE)
CLog::Log(LOGDEBUG, "%s::%s - %d %x %d", CLASSNAME, __func__, clear, flags, alpha);
CLog::Log(LOGDEBUG, "%s::%s - %d %x %d %d", CLASSNAME, __func__, clear, flags, alpha, source);
#endif

if (!m_bConfigured) return;

CSingleLock lock(g_graphicsContext);

ManageDisplay();

// if running bypass, then the player might need the src/dst rects
// for sizing video playback on a layer other than the gles layer.
if (m_RenderUpdateCallBackFn)
(*m_RenderUpdateCallBackFn)(m_RenderUpdateCallBackCtx, m_sourceRect, m_destRect);
}

void CMMALRenderer::FlipPage(int source)
{
if (!m_bConfigured || m_format == RENDER_FMT_BYPASS)
if (m_format == RENDER_FMT_BYPASS)
return;

#if defined(MMAL_DEBUG_VERBOSE)
CLog::Log(LOGDEBUG, "%s::%s - %d", CLASSNAME, __func__, source);
#endif

YUVBUFFER *buffer = &m_buffers[source];
// we only want to upload frames once
if (buffer->flipindex++)
Expand All @@ -387,6 +381,18 @@ void CMMALRenderer::FlipPage(int source)
else assert(0);
}

void CMMALRenderer::FlipPage(int source)
{
if (!m_bConfigured || m_format == RENDER_FMT_BYPASS)
return;

#if defined(MMAL_DEBUG_VERBOSE)
CLog::Log(LOGDEBUG, "%s::%s - %d", CLASSNAME, __func__, source);
#endif

m_iYV12RenderBuffer = source;
}

unsigned int CMMALRenderer::PreInit()
{
CSingleLock lock(g_graphicsContext);
Expand All @@ -406,6 +412,7 @@ unsigned int CMMALRenderer::PreInit()
m_formats.push_back(RENDER_FMT_MMAL);
m_formats.push_back(RENDER_FMT_BYPASS);

m_iYV12RenderBuffer = 0;
m_NumYV12Buffers = NUM_BUFFERS;

return 0;
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/VideoRenderers/MMALRenderer.h
Expand Up @@ -94,6 +94,7 @@ class CMMALRenderer : public CBaseRenderer, public CThread

void vout_input_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer);
protected:
int m_iYV12RenderBuffer;
int m_NumYV12Buffers;

std::vector<ERenderFormat> m_formats;
Expand Down

0 comments on commit 487c6dc

Please sign in to comment.