Skip to content
This repository
Browse code

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

… surfaces)
  • Loading branch information...
commit 993ed81954bd51dacb13d0b51e40668012dc47a7 1 parent 617df5e
Rainer Hochecker authored
16 xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.cpp
@@ -1145,11 +1145,18 @@ void CDecoder::Present(int index)
1145 1145
1146 1146 if (!m_presentPicture)
1147 1147 {
1148   - CLog::Log(LOGWARNING, "XVBA::Present: present picture is NULL");
1149   - return;
  1148 + // use last picture, we might processing a still frame here
  1149 + int lastIndex = (index + m_numRenderBuffers -1) % m_numRenderBuffers;
  1150 + m_presentPicture = m_flipBuffer[lastIndex].outPic;
  1151 + m_flipBuffer[lastIndex].isDuplicate = true;
  1152 + if (!m_presentPicture)
  1153 + {
  1154 + CLog::Log(LOGWARNING, "XVBA::Present: present picture is NULL");
  1155 + return;
  1156 + }
1150 1157 }
1151 1158
1152   - if (m_flipBuffer[index].outPic)
  1159 + if (m_flipBuffer[index].outPic && !m_flipBuffer[index].isDuplicate)
1153 1160 {
1154 1161 if (m_flipBuffer[index].outPic->render)
1155 1162 {
@@ -1163,6 +1170,7 @@ void CDecoder::Present(int index)
1163 1170 }
1164 1171
1165 1172 m_flipBuffer[index].outPic = m_presentPicture;
  1173 + m_flipBuffer[index].isDuplicate = false;
1166 1174 m_presentPicture = NULL;
1167 1175 }
1168 1176
@@ -1327,7 +1335,7 @@ void CDecoder::FinishGL()
1327 1335
1328 1336 for (unsigned int i=0; i<m_numRenderBuffers;++i)
1329 1337 {
1330   - if (m_flipBuffer[i].outPic)
  1338 + if (m_flipBuffer[i].outPic && !m_flipBuffer[i].isDuplicate)
1331 1339 {
1332 1340 { CSingleLock lock(m_videoSurfaceSec);
1333 1341 m_flipBuffer[i].outPic->render->state &= ~FF_XVBA_STATE_USED_FOR_RENDER;
1  xbmc/cores/dvdplayer/DVDCodecs/Video/XVBA.h
@@ -143,6 +143,7 @@ class CDecoder : public CDVDVideoCodecFFmpeg::IHardwareDecoder,
143 143 struct RenderPicture
144 144 {
145 145 OutputPicture *outPic;
  146 + bool isDuplicate;
146 147 void *glSurface[3];
147 148 GLuint glTexture[3];
148 149 };

0 comments on commit 993ed81

Please sign in to comment.
Something went wrong with that request. Please try again.