locked
H264 Decoder MFT ProcessOutput and "CopyDecodedFrame failed" RRS feed

  • Question

  • I am using the H.264 video decoder on a Win 10 system from a regular GUI (Qt) application and in this context all works well.

    I am also attempting to use this from within a Unity application (as a native plugin), and in this case it fails.   Specifically, after we get MF_E_TRANSFORM_STREAM_CHANGE from ProcessOutput, and provided ProcessOutput does not return MF_E_TRANSFORM_NEED_MORE_INPUT, then we get a "WinRT Originate Error".  In the working scenario, we would get S_OK and the actual frame would be returned.  Attaching with debugger we see that the error detail is:

    error=E_FAIL

    message=CopyDecodedFrame failed

    Sounds like an internal error.  The allocated buffer size is sufficiently large and is based on the size returned by GetOutputStreamInfo. As a precaution we doubled the cbSize but that made no difference.  cbAlignment is zero.

    It should be noted that from a Unity app, it isn't clear that there is a messaging loop or that we are called from a thread with a valid message loop.  So, to be cautious, we created a message loop thread (GetMessage / DispatchMessage) and made sure all interaction with the H264 decoder was performed from that thread only.  We also made sure to CoInitializeEx() from this thread.  Another important thing of note is that Unity uses DirectX9 or DX11, so if the MFT H264 decoder depends on GPU or DX in some way, it could be they clash.

    Could someone with visibility into the codec or with prior knowledge help us understand possible causes for "CopyDecodedFrame failed" ?

    TIA.


    Wednesday, January 13, 2016 9:56 PM