Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Sumit_S_
Beginner
84 Views

Decode init is failing in Join session.

I am trying to implement 1:N transcode application using opaque memory. I am creating and joining two sdk session.

After joining session, decode_init() function is giving -16 error. This implementation is working perfectly when using system memory as IO_PATTERN..

Attached is the tracer log of the init function.

Here is the implementation.

IMSDKVars* DecodeInit(){

    IMSDKVars *decodevars = (IMSDKVars*)malloc(sizeof(IMSDKVars));

    mfxIMPL impl = MFX_IMPL_AUTO_ANY;
    mfxVersion ver = { {17, 1} };
    decodevars->sts = MFXInit(impl, &ver, &decodevars->session);

    decodevars->sts = MFXInit(impl, &ver, &decodevars->session2);
    decodevars->sts = MFXJoinSession(decodevars->session,decodevars->session2);

    memset(&decodevars->mfxParams, 0, sizeof(decodevars->mfxParams));
    decodevars->mfxParams.mfx.CodecId = MFX_CODEC_AVC;
    decodevars->mfxParams.IOPattern = MFX_IOPATTERN_OUT_OPAQUE_MEMORY;
    decodevars->mfxParams.mfx.FrameInfo.Width = 3840;
    decodevars->mfxParams.mfx.FrameInfo.Height = 2160;
    decodevars->mfxParams.mfx.FrameInfo.CropX = 0;
    decodevars->mfxParams.mfx.FrameInfo.CropY = 0;
    decodevars->mfxParams.mfx.FrameInfo.CropW = 3840;
    decodevars->mfxParams.mfx.FrameInfo.CropH = 2160;
    decodevars->mfxParams.mfx.FrameInfo.FourCC = MFX_FOURCC_NV12;
    decodevars->mfxParams.AsyncDepth = 4;

    mfxFrameAllocRequest DecRequest;
    memset(&DecRequest, 0, sizeof(DecRequest));
    decodevars->sts = MFXVideoDECODE_QueryIOSurf(decodevars->session, &decodevars->mfxParams, &DecRequest);

    decodevars->numSurfaces = DecRequest.NumFrameSuggested;

    decodevars->pmfxSurfaces = (mfxFrameSurface1**)malloc(sizeof(mfxFrameSurface1*)*decodevars->numSurfaces);
    for (int i = 0; i < decodevars->numSurfaces; i++) {
        decodevars->pmfxSurfaces = (mfxFrameSurface1*)malloc(sizeof(mfxFrameSurface1));
        memset(decodevars->pmfxSurfaces, 0, sizeof(mfxFrameSurface1));
        memcpy(&(decodevars->pmfxSurfaces->Info), &(DecRequest.Info), sizeof(mfxFrameInfo));
    }

    memset(&decodevars->extOpaqueAlloc, 0, sizeof(decodevars->extOpaqueAlloc));
    decodevars->extOpaqueAlloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION;
    decodevars->extOpaqueAlloc.Header.BufferSz = sizeof(mfxExtOpaqueSurfaceAlloc);
    mfxExtBuffer* pExtParamsDec = (mfxExtBuffer*) & decodevars->extOpaqueAlloc;

    decodevars->extOpaqueAlloc.Out.Surfaces = decodevars->pmfxSurfaces;
    decodevars->extOpaqueAlloc.Out.NumSurface = decodevars->numSurfaces;
    decodevars->extOpaqueAlloc.Out.Type = DecRequest.Type;

    decodevars->mfxParams.ExtParam = &pExtParamsDec;
    decodevars->mfxParams.NumExtParam = 1;

    decodevars->sts = MFXVideoDECODE_Init(decodevars->session, &decodevars->mfxParams);

    return decodevars;
}

.530684

0 Kudos
0 Replies
Reply