Skip to content

Commit

Permalink
vdpau: cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta committed Nov 16, 2011
1 parent 9308421 commit 0de726f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
37 changes: 17 additions & 20 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,21 @@ void CVDPAU::SpewHardwareAvailable() //Copyright (c) 2008 Wladimir J. van der L

}

bool CVDPAU::IsSurfaceValid(vdpau_render_state *render)
{
// find render state in queue
bool found(false);
for(unsigned int i = 0; i < m_videoSurfaces.size(); ++i)
{
if(m_videoSurfaces[i] == render)
{
found = true;
break;
}
}
return found;
}

int CVDPAU::FFGetBuffer(AVCodecContext *avctx, AVFrame *pic)
{
//CLog::Log(LOGNOTICE,"%s",__FUNCTION__);
Expand Down Expand Up @@ -1185,16 +1200,7 @@ void CVDPAU::FFReleaseBuffer(AVCodecContext *avctx, AVFrame *pic)
pic->data[i]= NULL;

// find render state in queue
bool found(false);
for(i = 0; i < vdp->m_videoSurfaces.size(); ++i)
{
if(vdp->m_videoSurfaces[i] == render)
{
found = true;
break;
}
}
if (!found)
if (!vdp->IsSurfaceValid(render))
{
CLog::Log(LOGDEBUG, "CVDPAU::FFReleaseBuffer - ignoring invalid buffer");
return;
Expand Down Expand Up @@ -1320,16 +1326,7 @@ int CVDPAU::Decode(AVCodecContext *avctx, AVFrame *pFrame)
return VC_ERROR;

// ffmpeg vc-1 decoder does not flush, make sure the data buffer is still valid
bool found(false);
for(unsigned int i = 0; i < m_videoSurfaces.size(); ++i)
{
if(m_videoSurfaces[i] == render)
{
found = true;
break;
}
}
if (!found)
if (!IsSurfaceValid(render))
{
CLog::Log(LOGWARNING, "CVDPAU::Decode - ignoring invalid buffer");
return VC_BUFFER;
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class CVDPAU
void SpewHardwareAvailable();
void InitCSCMatrix(int Height);
bool CheckStatus(VdpStatus vdp_st, int line);
bool IsSurfaceValid(vdpau_render_state *render);

void CheckFeatures();
void SetColor();
Expand Down

0 comments on commit 0de726f

Please sign in to comment.