解码部分,RunDecoding,进入后,直接运行至while循环内。
mfxStatus sts = MFX_ERR_NONE;
while ((sts == err_no | more_data | more_surface) && (m_nFrames/*0xfffff..*/ > m_output_count))
{
if (sts == err_no | more_data | more_surface)
{
SyncFrameSurfaces();
{
msdkFrameSurface *cur = m_UsedSurfacesPool.m_pSurfacesHead; // surfacesPool,保存了surface头、尾、锁,类似于维护surface的一个双向链表,freepool有个比较重要的成员msdkFrameSurfaces *m_pSurfaces,usedpool有两个指明的成员msdkFrameSurface *m_pSurfacesHead, *m_pSurfacesTail
while (cur)
{
if (cur->frame.Data.Locked || cur->render_lock)
{
cur = cur->next; // 若locked,移到下一个surface
}
else
{
m_UsedSurfacesPool.DetachSurfaceUnsafe(cur); // 从用过的链表中剥离
m_FreeSurfacesPool.AddSurfaceUnsafe(cur); // 添加到空闲链表
}
}
}
SyncVppFramesSurfaces(); // 同上
m_pCurrentFreeSurface = m_FreeSurfacesPool.GetSurface();
}
}