Hello
I have added an auto-detection piece of code to our software, where it tries to initialize a hardware encoder, and if that fails, uses a non-intel encoder (mostly for older hardware and non Intel hardware).
The function, as shown below, tries to initialize the encoder, then asks for the implementation (hardware/software). No matter what the result is, when MFXClose is called, the program crashes, while my understanding from the documentation is that it should work fine. What am I missing ?
regards
Jack
UINT8 QSVEncodingAvailable()
{
mfxVersion ver = {0, 1};
mfxSession EncoderSession;
mfxStatus Status=MFXInit (MFX_IMPL_AUTO_ANY,&ver,&EncoderSession);
if (Status!=MFX_ERR_NONE)
{
SHOWMSG(DBGID_ENCODER, DBG_LEVEL_TRACE1, ("QSVEncodingAvailable failed : Init failed=%d\\n", Status));
// Removed, May cause a leak, but it appears to be an intel bug. When not initializing fully, crashes when this line is reached
// MFXClose (EncoderSession);
return false;
}
mfxIMPL Implementation;
Status=MFXQueryIMPL (EncoderSession,&Implementation);
if (Status!=MFX_ERR_NONE)
{
SHOWMSG(DBGID_ENCODER, DBG_LEVEL_TRACE1, ("QSVEncodingAvailable failed : mfxQueryIMPL failed=%d\\n", Status));
// Removed, May cause a leak, but it appears to be an intel bug. When not initializing fully, crashes when this line is reached
// MFXClose (EncoderSession);
return false;
}
// Removed, May cause a leak, but it appears to be an intel bug. When not initializing fully, crashes when this line is reached
//MFXClose (EncoderSession);
//if (Implementation==MFX_IMPL_SOFTWARE)
//{
// SHOWMSG(DBGID_ENCODER, DBG_LEVEL_TRACE1, ("QSVEncodingAvailable failed : Software-only implementation found\\n"));
// return false;
//}
SHOWMSG(DBGID_ENCODER, DBG_LEVEL_TRACE1, ("QSVEncodingAvailable tested and working\\n"));
return true;
}




