obs-qsv11: Fix win7 crash when fake monitor isn't forced

When using QSV is used on a windows 7 machine with a dedicated card, you
have to fake a monitor connection to your Intel graphics to be able to
use QSV.  If you do not, the initialization will fail with an error.
The error for that situation is not handled properly, and a variable
will be used while null.  Instead, the function should safely return
after that error is received.

Also, do not call ClearData in the destructor unless QSV has been
properly initialized (if m_pmfxENC is null).
This commit is contained in:
jp9000 2016-04-19 12:18:58 -07:00
parent 43eba49a50
commit a39cde9d08

View File

@ -126,7 +126,8 @@ QSV_Encoder_Internal::QSV_Encoder_Internal(mfxIMPL& impl, mfxVersion& version) :
QSV_Encoder_Internal::~QSV_Encoder_Internal()
{
ClearData();
if (m_pmfxENC)
ClearData();
}
mfxStatus QSV_Encoder_Internal::Open(qsv_param_t * pParams)
@ -140,8 +141,9 @@ mfxStatus QSV_Encoder_Internal::Open(qsv_param_t * pParams)
// Use system memory
sts = Initialize(m_impl, m_ver, &m_session, NULL);
if (sts == MFX_ERR_NONE)
m_pmfxENC = new MFXVideoENCODE(m_session);
MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);
m_pmfxENC = new MFXVideoENCODE(m_session);
InitParams(pParams);