I am implementing a video player using the Intel MSDK for decoding. At the end of a file, I flush the remaining frames by passing null to DecodeFrameAsync, like so:
mfxFrameSurface1* outSurface = nullptr;I've elided some of the error checking for conciseness.
mfxSyncPoint syncPoint;
int index = GetFreeSurfaceIndex(...);
mfxStatus sts = m_mfxVideoDecoder->DecodeFrameAsync(nullptr, &(m_mfxFrameSurfaces[index]), &outSurface, &syncPoint);
if (sts == MFX_ERR_MORE_DATA) { return; }
DebugPrint(sts);
sts = m_mfxVideoSession->SyncOperation(syncPoint, MSDK_DEC_WAIT_INTERVAL);
DebugPrint(sts);
// now outSurface is a new frame, enqueue it
return;
This works fine in general, however with one particular video file the first DebugPrint shows MFX_WRN_DEVICE_BUSY, and then the second shows MFX_ERR_NULL_PTR. First, I am puzzled as to why the API would return DEVICE_BUSY since I am stepping through my code very slowly in the debugger and it has had ample time to finish the operation, but anyway, the most important question is, what am I supposed to do in this case? Should I just repeat the method call until it returns something else?