Intel-Media-SDK / MediaSDK

The Intel® Media SDK
MIT License
927 stars 457 forks source link

H264 YUY2 MFXVideoENCODE_Init return MFX_WRN_INCOMPATIBLE_VIDEO_PARAM from internal defaults #2818

Closed MathieuGirard closed 2 years ago

MathieuGirard commented 2 years ago

My code do not pass a mfxExtMultiFrameControl ext buffer, but internal code is generating a default one that emit the error.

before the check on MFEMode and timeout the changed variable is false. The failed check is internally introduced.

Constructed and zeroed here: https://github.com/Intel-Media-SDK/MediaSDK/blob/e6a917d6171cbdfd4e5eb7477f8bb226749ffa97/_studio/mfx_lib/shared/src/mfx_h264_enc_common_hw.cpp#L8071

Here timeout is simply forced with an invalid timeout here (all fields a zero before the correction): https://github.com/Intel-Media-SDK/MediaSDK/blob/e6a917d6171cbdfd4e5eb7477f8bb226749ffa97/_studio/mfx_lib/shared/src/mfx_h264_enc_common_hw.cpp#L5623-L5629

Here we decide to return an warning because the timeout force is invalid with the mode (0 : DEFAULT): https://github.com/Intel-Media-SDK/MediaSDK/blob/e6a917d6171cbdfd4e5eb7477f8bb226749ffa97/_studio/mfx_lib/shared/src/mfx_h264_enc_common_hw.cpp#L4922-L4927

MathieuGirard commented 2 years ago

Suggested fix at line 4923:

    if (mfeControl)
    {
        if (!mfeControl->Timeout && mfeParam.MFMode == MFX_MF_AUTO)
        {
            mfeControl->Timeout = calculateMfeTimeout(par.mfx.FrameInfo);
        }
    }
dmitryermilov commented 2 years ago

@MathieuGirard , thanks for clear explanation ! Your proposal looks good.