Commit 18881db2 authored by atyugina's avatar atyugina Committed by Oleg Nabiullin

[samples][AVC FEI] Fix the logic of null-pointer check

parent 3b151697
......@@ -689,19 +689,19 @@ mfxStatus FEI_EncodeInterface::EncodeOneFrame(iTask* eTask)
{
MFX_ITT_TASK("EncodeOneFrame");
MSDK_CHECK_POINTER(eTask, MFX_ERR_NULL_PTR);
mfxStatus sts = MFX_ERR_NONE;
// ENC_in.InSurface always holds full-res surface
mfxFrameSurface1* encodeSurface = eTask->ENC_in.InSurface;
// ENC_in.InSurface always holds full-res surface.
// eTask=NULL is valid for the case of draining encoder frames when input is in display order.
mfxFrameSurface1* encodeSurface = eTask ? eTask->ENC_in.InSurface : nullptr;
if (encodeSurface) // no need to do this for buffered frames
{
sts = InitFrameParams(eTask);
MSDK_CHECK_STATUS(sts, "FEI ENCODE: InitFrameParams failed");
}
int numberOfCalls = (m_bSingleFieldMode && eTask->m_fieldPicFlag) ? 2 : 1;
int numberOfCalls = (m_bSingleFieldMode && (!eTask || eTask->m_fieldPicFlag)) ? 2 : 1;
for (int i = 0; i < numberOfCalls; ++i)
{
for (;;) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment