Permalink
Browse files

xvba: decoder, fix picture jumping after a stream has stalled (shared…

… surfaces)
  • Loading branch information...
1 parent 617df5e commit 993ed81954bd51dacb13d0b51e40668012dc47a7 @FernetMenta committed Dec 18, 2011
Showing with 13 additions and 4 deletions.
  1. +12 −4 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp
  2. +1 −0 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.h
View
16 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp
@@ -1145,11 +1145,18 @@ void CDecoder::Present(int index)
if (!m_presentPicture)
{
- CLog::Log(LOGWARNING, "XVBA::Present: present picture is NULL");
- return;
+ // use last picture, we might processing a still frame here
+ int lastIndex = (index + m_numRenderBuffers -1) % m_numRenderBuffers;
+ m_presentPicture = m_flipBuffer[lastIndex].outPic;
+ m_flipBuffer[lastIndex].isDuplicate = true;
+ if (!m_presentPicture)
+ {
+ CLog::Log(LOGWARNING, "XVBA::Present: present picture is NULL");
+ return;
+ }
}
- if (m_flipBuffer[index].outPic)
+ if (m_flipBuffer[index].outPic && !m_flipBuffer[index].isDuplicate)
{
if (m_flipBuffer[index].outPic->render)
{
@@ -1163,6 +1170,7 @@ void CDecoder::Present(int index)
}
m_flipBuffer[index].outPic = m_presentPicture;
+ m_flipBuffer[index].isDuplicate = false;
m_presentPicture = NULL;
}
@@ -1327,7 +1335,7 @@ void CDecoder::FinishGL()
for (unsigned int i=0; i<m_numRenderBuffers;++i)
{
- if (m_flipBuffer[i].outPic)
+ if (m_flipBuffer[i].outPic && !m_flipBuffer[i].isDuplicate)
{
{ CSingleLock lock(m_videoSurfaceSec);
m_flipBuffer[i].outPic->render->state &= ~FF_XVBA_STATE_USED_FOR_RENDER;
View
1 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.h
@@ -143,6 +143,7 @@ class CDecoder : public CDVDVideoCodecFFmpeg::IHardwareDecoder,
struct RenderPicture
{
OutputPicture *outPic;
+ bool isDuplicate;
void *glSurface[3];
GLuint glTexture[3];
};

0 comments on commit 993ed81

Please sign in to comment.